-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS builds are not reproducible #16028
Comments
Debug builds will never be fully reproducible due to presence of debug symbol stabs which will include mtime of the SOs and OSOs. Release builds with debug info stripped should be fully reproducible however. |
I am closing this issue as not applicable since we only guarantee build reproducibility for release builds and with debug info stripped. We have appropriate CI checks to that effect too: zig/ci/x86_64-macos-release.sh Line 71 in a2ad851
zig/ci/aarch64-macos-release.sh Line 67 in a2ad851
|
@kubkon Thanks for clarifying! It's understandable that there is no desire to guarantee reproducibility for binaries that contain debug information. In the Bazel use-case it is still problematic (aherrmann/rules_zig#79) as Bazel performs builds in a temporary sandbox working directory and consequently the embedded debug source paths are non-deterministic, and Bazel's (distributed) caching is based on content hashing. So, non-deterministic outputs increase cache misses and prevent features like early cut-off. If the only source of indeterminism are these source paths. Would it be feasible to generate relative debug source paths or let the user control the debug source path prefix? If so, would it be viable to extend the reproducibility guarantees to debug builds with the caveat that they are only reproducible if the debug source prefix is controlled? I saw that #9361 already requests project relative debug paths. Relatedly, there is an issue about debugging as well, where the embedded paths pointing to the sandbox working directory are no longer valid when users attempt to debug the produced binary, see aherrmann/rules_zig#207. |
For MachO with traditional debug info stabs you get nondeterminism from both file paths and mtime values embedded in the symbol table of the final image. It may be a better option to simply always request a dSYM bundle which would allow us strip all debug info stabs from the binary while preserving debug info in a standalone file. Please note that emitting dSYM is still a todo. |
Thanks! Makes sense. It sounds like separating debug symbols is the better option then. There's precedent for this in Bazel so, it should be feasible. |
Zig Version
0.11.0-dev.3395+1e7dcaa3a
Steps to Reproduce and Observed Behavior
Adjust the path to the Zig compiler and invoke the following script twice:
The output I observe on Ubuntu 22.04 is the following:
This indicates two issues:
(I found #13919 as a relevant issue. However, it is closed as fixed.)
Expected Behavior
(Side note: I see that the Debug build mode has no reproducibility requirement. This is problematic for build systems that use content addressed storage for caching, such as Bazel.)
The text was updated successfully, but these errors were encountered: