How to make GCC create checksum-same builds?

4

In company where I work there is complicated industrial ARM arch router project, consisting primarily of many C and C++ apps with Linux kernel. Currently we are preparing to certification and certification organization wants us to send them all sources and binary checksum of resulting root filesystem image. Of course checksum we send them and checksum of image that they will get after build should be same.

I tried to sequentially build same app (I choosed busybox) on same host twice and got two different checksums. I've tried to solve it using answer https://superuser.com/a/1092566/851200 (pass -frandom-seed=123 as compile flag) - haven't helped.

If I could build same app with same checksum twice on same host - I think the problem will be practically solved cause we could say to certification organization "Build soft on Ubuntu 18.04.3 with GCC 7.5.0-3ubuntu1~18.04 with ARM GNUEABI GCC 4.8.5 built from sources that we gave you etc" and base soft will be same and it will be identical to build on same system case. But maybe I miss something.

Could anybody help me?

UPDATE:

I tried to see what exactly differs in resulting binary files using arm-linux-gnueabi-readelf -a and got following diff for two sequential builds on same machine for busybox:

--- a   2020-03-24 16:17:51.901192012 +0500
+++ b   2020-03-24 16:18:47.152671408 +0500
@@ -1404,7 +1404,7 @@
 Displaying notes found at file offset 0x00000168 with length 0x00000020:
   Owner                 Data size      Description
   GNU                  0x00000010      NT_GNU_BUILD_ID (unique build ID bitstring)
-    Build ID: ecc0ddee1a1f50c9b4ac98477be7ba55
+    Build ID: edab8a4ee42f8fd0e4ee7e931639f226
 Attribute Section: aeabi
 File Attributes
   Tag_CPU_name: "5TE"

Then I checked GCC man page and see If style is omitted, "sha1" is used ... The "md5" and "sha1" styles produces an identifier that is always the same in an identical output file. So defaults should be OK and produce same Build ID, but it is not.

c++
c
gcc
build
binary-reproducibility
asked on Stack Overflow Mar 20, 2020 by Dmitriy Vinokurov • edited Mar 24, 2020 by Dmitriy Vinokurov

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0