Compilers aren’t all that deterministic without effort. Example, both gc and clang if ran with parallelism can produce different results purely off file system lookup differences alone. This means intermediate archive files can be equivalent in content from the perspective of functions built but differ in order. This can easily filter up to the final binary being different. Making compilers bitwise deterministic is a lot more effort than running the same compiler on the same input. This is ignoring things like timestamps and other common sources of non determinism. But I can say the Debian reproducible build project has most of this figured out but compilers are not as deterministic as your comment implies. They can be, but you should really check that your final binary is bit for but the same. If you’ve used any parallelism it likely isn’t.
If we then bring in lto et al it gets worse.
Let’s take just gcc, are you setting -frandom-seed, SOURCE_DATE_EPOCH, -file-prefix-map, are you ensuring the input file list is deterministic? If you’ve used any can’t affirm yes to at least these 4, note these are just the things I can remember, you do not have a deterministic compile chain.
Compilers aren’t all that deterministic without effort. Example, both gc and clang if ran with parallelism can produce different results purely off file system lookup differences alone. This means intermediate archive files can be equivalent in content from the perspective of functions built but differ in order. This can easily filter up to the final binary being different. Making compilers bitwise deterministic is a lot more effort than running the same compiler on the same input. This is ignoring things like timestamps and other common sources of non determinism. But I can say the Debian reproducible build project has most of this figured out but compilers are not as deterministic as your comment implies. They can be, but you should really check that your final binary is bit for but the same. If you’ve used any parallelism it likely isn’t.
If we then bring in lto et al it gets worse.
Let’s take just gcc, are you setting -frandom-seed, SOURCE_DATE_EPOCH, -file-prefix-map, are you ensuring the input file list is deterministic? If you’ve used any can’t affirm yes to at least these 4, note these are just the things I can remember, you do not have a deterministic compile chain.