Reputation: 857
Scenario: A build of a C++ project (under Linux with gcc) is supposed to be repeated on a new machine.
If the very same gcc version is used for the build: Is the build output (binaries) identical? Or are time stamps, path, or other information contained in the binary that makes them different? If the output is not identical: Can the output be compared in a way to see if the binaries are "functional" identical? I.e. can a tool be called that just compares the actual code inside the binary (without meta data like e.g. debug info)?
Motivation: I have to prepare a clean new Linux system on which a software system (that was developed by someone else, let's call them X) has to be built. In order to build the software I will get a source tree with build scripts, makefiles etc. Now I have to check that the build output is the same as the last build that was provided by X (and built on their system). I need to do this to make sure that the source that will be handed over is the same that was used to build the last version that we got in binary form from X.
Upvotes: 0
Views: 236
Reputation: 51
If the very same gcc version is used for the build: Is the build output (binaries) identical?
What changes is the CPU more than the version of GCC and the static linking it does. I believe the answer you are looking for lies here.
It basically boils dow to "it depends". Quoting the linked answer by Rici :
the binaries are likely to differ unless the CPUs are similar (and even then, it's possible)
And like Oliv said, objdump
is also a good way to compare the differences.
Upvotes: 1