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

richard.purdie at linuxfoundation.org richard.purdie at linuxfoundation.org
Fri Jun 7 12:42:07 UTC 2019


On Fri, 2019-06-07 at 14:29 +0200, Sebastian Huber wrote:
> 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

Sorry, "." was just the end of the sentence. I just mean that we use
that commandline option to ensure the output is reproducible.

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

We already pass in various compiler flags when building things so we
included the right options for reproducibility as well.

> 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.

Yocto Project's builds and SDKs can be run or installed at arbitrary
locations without changing the build output result. We also have fairly
good debug symbol/debug source handling for the target (split into
separate but linked objects which can be optionally installed).

Cheers,

Richard







More information about the rb-general mailing list