I work in a very regulated environment where we need to be able to produce identical binary input give the same source code every time be build out products. We currently u
The Debian Reproducible builds project attempts to standardize Debian packages byte-by-byte, and has received a Linux Foundation grant in 2016.
While this may include more than compilation, you should have a look at it.
It also pointed me to this article, which adds the following points to what @Employed said:
/tmp/build
) to deal with __FILE__
__DATE__
, __TIME__
, __TIMESTAMP__
:
-D
-Wdate-time
or -Werror=date-time
: warn or fail if either __TIME__
, __DATE__
or __TIMESTAMP__
are is used. The Linux kernel 4.4 uses it by default. D
flag with ar
, or use https://github.com/nh2/ar-timestamp-wiper/tree/master to wipe stamps-fno-guess-branch-probability
: older manual versions say it is a source of non-determinism, but not anymore. Not sure if this is covered by -frandom-seed
or not.Buildroot has a BR2_REPRODUCIBLE
option which may give some ideas on the package level, but it is far from complete at this point.
Related threads: