[QBS] Follow-up on reproducible builds

Jake Petroules jake.petroules at petroules.com
Mon Aug 24 07:31:08 CEST 2015


> On Aug 23, 2015, at 9:44 PM, Stephan Gatzka <stephan.gatzka at gmail.com> wrote:
> 
> Hi,
> 
> We still lack a test for reproducible builds. I asked the gcc guys and
> got the answer, that pretty much anything compiled with -flto leads to
> different binaries.
> 
> So I tried it out:
> cat a.c:
> int bar (void) { return 0; }
> 
> gcc -flto -c -o a1.o a.c
> gcc -flto -c -o a2.o a.c
> diff a1.o a2.o
> Binary files a1.o and a2.o differ
> 
> gcc -flto -c -frandom-seed=123 -o a1.o a.c
> gcc -flto -c -frandom-seed=123 -o a2.o a.c
> diff a1.o a2.o
> 
> Unfortunately, this example only works for gcc, not clang. Clang still
> produces identical binaries.
> 
> Regards,
> 
> Stephan
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs

Apparently clang only accepts this argument for gcc compatibility and otherwise ignores it completely since such a thing isn't needed in the first place.

https://github.com/llvm-mirror/clang/blob/master/include/clang/Driver/Options.td#L949 <https://github.com/llvm-mirror/clang/blob/master/include/clang/Driver/Options.td#L949> indicates it's in the "ignored" group of compiler options

Turning on verbose mode indicates it's not used:

$ clang++ -v -frandom-seed=xxx
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
clang: warning: argument unused during compilation: '-frandom-seed=xxx'

...and you already demonstrated that the produced object files are identical.

So, it looks like the thing to do is to not pass the -frandom-seed argument and skip the autotest for clang, and add -flto to cpp.linkerFlags for the autotest for GCC.
-- 
Jake Petroules - jake.petroules at petroules.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150823/54a826a7/attachment.html>


More information about the Qbs mailing list