[rb-general] Reproducible build of a GCC cross-compiler?

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 7 12:29:45 UTC 2019


On 07/06/2019 13:54, Richard Purdie wrote:
> On Fri, 2019-06-07 at 13:41 +0200, Sebastian Huber wrote:
>> Hello,
>>
>> has someone tried to do a reproducible build of a GCC cross-compiler?
>> I
>> am not interested in a native GCC. I guess it needs some tweaks in
>> the
>> build system of GCC, e.g.
>>
>> * use of -frandom-seed=???
>>
>> * export SOURCE_DATE_EPOCH=???
>>
>> * -ffile-prefix-map=???=???
>>
>> * etc.
>>
>> It seems there is no magic configuration option in
>>
>> https://gcc.gnu.org/install/configure.html
>>
>> to enable a reproducible build.
> 
> The Yocto Project builds and uses gcc cross compilers and we believe
> our builds to be reproducible when configured to be.
> 
> We do use SOURCE_DATE_EPOCH and -ffile-prefix-map=.

Interesting, a "-ffile-prefix-map=." is not documented. What I find is this:

https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options

"-fdebug-prefix-map=old=new

     When compiling files residing in directory old, record debugging 
information describing them as if the files resided in directory new 
instead. This can be used to replace a build-time path with an 
install-time path in the debug info. It can also be used to change an 
absolute path to a relative path by using . for new. This can give more 
reproducible builds, which are location independent, but may require an 
extra command to tell GDB where to find the source files. See also 
-ffile-prefix-map."

It only says "." for new. What effect has this setting?

How did you propagate the settings to the newly built cross compiler 
invoked to build the target libraries?

It would be nice if I could build the cross compiler and the target 
libraries at an arbitrary location and then install the binaries and 
sources at some prefix. If I debug an application it will find the 
Newlib sources in the prefix automatically.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the rb-general mailing list