produced executables should be identical when produced in different folders
When working on #6311 I noticed the sha256sum of executables was different if they were built in a different folder. The path of the platform was included in the debuginfo.
There are other differences as well, we should find where all of these come from and eliminate them.
Finding the origin of these differences can be a good first issue for someone with some low level linux executable experience.
- [ ] Once the differences have been removed we should add a CI test that verifies this reproducibility.
I started looking into this. Initially looking at mach-O binaries.
In the output of dsymutil -s bench-folder-main/crates/cli_testing_examples/benchmarks/nQueens, I can see a few absolute paths that may be one issue.
[ 641] 000080f3 64 (N_SO ) 00 0000 0000000000000000 '/Users/jschear/dev/roc/bench-folder-main/crates/cli_testing_examples/benchmarks/platform/'
[ 643] 00008152 66 (N_OSO ) 00 0001 0000000065d6d49b '/Users/jschear/dev/roc/bench-folder-main/crates/cli_testing_examples/benchmarks/platform/macos-arm64.o'
I don't have a good sense of where to insert this yet, but there's a potentially useful -oso_prefix linker flag to get rid of these absolute paths: https://milen.me/writings/apple-linker-ld64-deterministic-builds-oso-prefix
(Still reading up on the linking story for roc, this may not apply.)
Check out the link.rs file which I think is crates/build (can't check right now). There are linker commands in there. Partly depends on the host language. Longer term, we want to take the host language dependent stuff out of the compiler but it's there for now.