-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Windows builds are not deterministic with --crate-type=bin and path-prefix remapping #88982
Comments
These tests fail on Windows, as the build is not deterministic there for bin targets. Issue rust-lang#88982 is filed for this problem.
2 tests that demonstrate this failure are being added in #87320, with them disabled at the moment: https://github.com/rust-lang/rust/pull/87320/files#diff-ef6ac253a54908edf6e7bc0670cd3e2756ba7cea7d203016b7e4ca1520928701R17
|
Is #87825 perhaps related? |
Likely, thanks. I'm working on getting a Windows environment set up and can confirm then. Also attempting to sort out what clang does here, since Chromium has no such C++ problems. |
I created a Docker development environment and sample application which replicates this issue https://github.com/nellshamrell/reproducible_build_basic_exp (it does still require a Windows workstation with Docker installed) |
UPDATE - passing the Clink-arg=/Brepro to rustc appears to make .exe binaries (at least with the one project I tested) build reproducibly! Going to try this in that test and see if it helps. |
We've gotten as far as trying to build Rust things on Windows in Chromium and our determinism bot quickly found rustc-link-driven outputs to be non-deterministic. Debugging happened here: https://bugs.chromium.org/p/chromium/issues/detail?id=1453509 The problem is that rustc is passing absolute paths for object files to lld-link, which then encodes them into the .EXE and .PDB file.
The .EXE itself has bits that differ and which are not the path strings themselves, but when these paths are all made relative (including by moving the /tmp object to a relative path) then the .EXE differences go away. |
The existing reproducible-build tests only verify that building with
--crate-type=rlib
produces the same output when building from different locations when using--remap-path-prefix
to strip out the location differences.#87320 adds another way to do this with
--remap-cwd-prefix
. It added a test that verifies the same thing with rlibs, but also added a test for--crate-type=bin
. This test forbin
passes on Linux but fails with a difference in the output on Windows: #87320 (comment)To verify, I added another test of
--remap-path-prefix
with--crate-type=bin
to see if that produces non-deterministic build outputs on Windows as well, and it does: #87320 (comment)Thus we see that the output of
--crate-type=bin
is not deterministic on Windows, based on running rustc from different directories.Meta
This is with rustc at tip of tree, as the commit queue found it in merge e63d3d7 .
HEAD was c3c0f80d608 at that time, I believe.
No root cause determined yet, and I don't have the Windows binary outputs to see what is at the differing location yet.
The text was updated successfully, but these errors were encountered: