Skip to content

Windows builds are not deterministic with --crate-type=bin and path-prefix remapping #88982

Open
@danakj

Description

@danakj

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 for bin passes on Linux but fails with a difference in the output on Windows: #87320 (comment)

2021-09-15T00:11:03.6840467Z /d/a/rust/rust/build/x86_64-pc-windows-msvc/test/run-make-fulldeps/reproducible-
build/reproducible-build/first /d/a/rust/rust/build/x86_64-pc-windows-msvc/test/run-make-fulldeps/reproducible-build/
reproducible-build/reproducible-build differ: char 140561, line 276  <<<<====
2021-09-15T00:11:03.6843153Z make[1]: Leaving directory '/d/a/rust/rust/src/test/run-make-fulldeps/reproducible-build'
2021-09-15T00:11:03.6843848Z 
2021-09-15T00:11:03.6844310Z ------------------------------------------
2021-09-15T00:11:03.6844776Z stderr:
2021-09-15T00:11:03.6845251Z ------------------------------------------
2021-09-15T00:11:03.6845850Z make[1]: *** [Makefile:78: remap_cwd_bin] Error 1

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)

2021-09-15T16:43:43.1281275Z /d/a/rust/rust/build/x86_64-pc-windows-msvc/test/run-make-fulldeps/reproducible-
build/reproducible-build/reproducible-build /d/a/rust/rust/build/x86_64-pc-windows-msvc/test/run-make-fulldeps/reproducible-
build/reproducible-build/foo differ: char 139921, line 272  <<<<====
2021-09-15T16:43:43.1282876Z make[1]: Leaving directory '/d/a/rust/rust/src/test/run-make-fulldeps/reproducible-build'
2021-09-15T16:43:43.1283397Z 
2021-09-15T16:43:43.1283769Z ------------------------------------------
2021-09-15T16:43:43.1284164Z stderr:
2021-09-15T16:43:43.1284554Z ------------------------------------------
2021-09-15T16:43:43.1285077Z make[1]: *** [Makefile:72: different_source_dirs_bin] Error 1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.O-windowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions