Questions tagged [binary-reproducibility]

the goal or quality of consistently reproducing identical build output given identical source input, or often more specifically the goal of byte-for-byte identical executable files when built repeatedly, perhaps on different machines or at different times

Binary reproducibility is the goal or quality of consistently reproducing identical build output given identical source input, or often more specifically the goal of byte-for-byte identical executable files (or identical checksums, hashes or other digests of those files) when built repeatedly, perhaps on different machines or at different times. The process by which this is achieved is often called a deterministic build or reproducible build.

For software subject to a requirement to be able to determine whether an arbitrary executable resulted from building a specific set of sources, binary reproducibility provides a straightforward, easily explained answer to that requirement. This requirement is often applied to software that is security-sensitive (e.g. Bitcoin Core, Tor), or used in a heavily regulated market (e.g. avionics, health care equipment, licensed gambling).

A number of tools or elements involved in builds may hamper this goal for a variety of reasons. Inclusion of environmental information such as timestamps, compiler versions, user and computer names and absolute paths is common, as is inclusion of a random UUID on every run to simplify matching of an executable with related files such as detached debug symbols or platform-specific native images. Many compilers produce nondeterministic compiler-generated symbol names, either for constructs explicitly defined but not named by in source code, or as an artifact of an implementation detail not surfaced in source code at all. Finally, highly optimizing compilers may employ nondeterministic optimization techniques such as Monte Carlo simulation guided optimization or profile guided optimization.

66 questions
112
votes
3 answers

Why don't two binaries of programs with only comments changed exactly match in gcc?

I created two C programs Program 1 int main() { } Program 2 int main() { //Some Harmless comments } AFAIK, when compiling, the compiler(gcc) should ignore the comments and redundant whitepaces, and hence the output must be similar. But when I…
Registered User
  • 2,239
  • 3
  • 32
  • 58
36
votes
4 answers

Why is the binary output not equal when compiling again?

I'm using a build script to compile several C# projects. The binary output is copied to a result folder, overwriting the previous version of the files, and then added/committed to subversion. I noticed that the binary output of the compilation are…
mafu
  • 31,798
  • 42
  • 154
  • 247
30
votes
7 answers

Determine whether .NET assemblies were built from the same source

Does anyone know of a way to compare two .NET assemblies to determine whether they were built from the "same" source files? I am aware that there are some differencing utilities available, such as the plugin for Reflector, but I am not interested in…
Clayton
  • 301
  • 3
  • 4
20
votes
6 answers

How to always produce byte-for-byte identical .exe on rebuild of C# application?

I'll give you a little bit of background first as to why I'm asking this question: I am currently working in a stricly-regulated industry and as such our code is quite carefully looked-over by official test houses. These test houses expect to be…
Siyfion
  • 416
  • 1
  • 6
  • 17
18
votes
1 answer

NuGet lock file fails to restore with --locked-mode

Roslyn gave us deterministic builds a few years ago. And with the addition of NuGet lock files, we can finally have guaranteed reproducible build. I'm looking at the docs that say I can opt-in with --use-lock-file Bootstraps use of lock file for a…
Bruno Garcia
  • 6,029
  • 3
  • 25
  • 38
13
votes
6 answers

Why does C# generate different EXEs for the same source-code?

Every time we recompile our C# application we end up with EXEs with different MD5 signatures. We are recompiling on the same machine, minutes apart. Why doesn't the same source-code yield the same output? Is there a way to fix this?
Gili
  • 86,244
  • 97
  • 390
  • 689
12
votes
5 answers

Why building the same project generates different EXE file for each developer

My team and I are developing a VC++ 6 project. We are all using the same code-base (using version control system), and all our compiler/linker/environment-settings (including include directories order), as far as we can tell, are exactly the…
Lior Kogan
  • 19,919
  • 6
  • 53
  • 85
12
votes
3 answers

How to store CMake build settings

There are often many swiches to enable/disable when trying to build a project that uses CMake. How do you store the build settings made by some user to make a build reproduceable on another machine? Is there some kind of export functionality or do…
Beachwalker
  • 7,685
  • 6
  • 52
  • 94
9
votes
4 answers

Comparing generated executables for equivilance

I need to compare 2 executables and/or shared objects, compiled using the same compiler/flags and verify that they have not changed. We work in a regulated environment, so it would be really useful for testing purposes to isolate exactly what parts…
Luciano
  • 1,571
  • 3
  • 17
  • 23
7
votes
3 answers

Can the Java 8 compiler be forced into creating reproducible class files?

My employer has a business need to make Java builds byte-for-byte reproducible. I am aware of the difficulties in making JAR files reproducible (due to archiving order and time stamps), but at this point I’m talking about class files. I have builds…
6
votes
3 answers

How to make Android applications with reproducible builds?

In my experience, recompiling the source code for the same Android application won't produce the same binary every time. A reproducible build is very useful for developers, but I think the most important benefit from a reproducible build process is…
manhood
  • 61
  • 4
6
votes
3 answers

Compiling Twice with Delphi 6 and getting the same checksum on the binary

For the purposes of binary / source code verification, i'd like to be able to make two compiles on the same computer 2 weeks apart and have the binaries be identical and thus pass some checksum test. So far I've found that most likely the timestamp…
6
votes
2 answers

Binary Reproducibility in Visual C++

Is there a way to force the same code to produce the same binary in Visual C++? Turn off the timestamp in the PE or force the timestamp in the PE to be some fixed value, in other words?
6
votes
6 answers

How to build the same Linux Kernel twice sources and get the same checksum

I'm searching if it's possible to build the same Linux Kerneltwice (same sources, same environment, same options, same compiler) and get the same checksum. Anybody knows how to do so?
gsempe
  • 5,371
  • 2
  • 25
  • 29
5
votes
4 answers

Repeatable object code generation c++

When I build a project using a c++ compiler, can I make sure that the produced binary is not affected if there were no changes in source code? It looks like everytime I recompile my source, the binary's md5 checksum is affected. Is the time of…
user70336
  • 51
  • 1
1
2 3 4 5