Not reproducible when a project is copied to another directory #13586
Labels
A-reproducibility
Area: reproducible / deterministic builds
C-bug
Category: bug
S-needs-info
Status: Needs more info, such as a reproduction or more background for a feature request.
The Compiled Binary Files Are Inconsistent After the Directory of the Rust Package Is Changed.
It is important to have reproducible builds.
Let's say I have two crate in my project, crate mangle2 depends on crate mangle1 and they are located in directory1.
mangle1/Cargo.toml file:
mangle1/src/lib.rs file:
in mangle2/Cargo.toml file, we see mangle2 depends on mangle1.
in mangle2/src/lib.rs file
Then I went into the mangle2 directory and compiled the whole project.
when compiling mangle2, we see -C metadata=b27aeebcd77b3cf1.
Then I copied the directory1 directory to another location directory2.
As before, I went into the mangle2 directory and compiled the whole project.
this time when compiling mangle2, we see -C metadata=6bc8f0dbcefdbca3.
The metadata of the two compilations is different. Therefore, the symbol table names in the generated binary files are different.
_ZN7mangle29super_add17heef584606885c889E change to _ZN7mangle29super_add17h7cd0a6fdff1a3985E
I just copied the project to a different directory and didn't change any code. Compiling in different directories caused binary inconsistencies.
If a single crate is copied to another directory for compilation, this problem does not occur. Binary inconsistency occurs when two crates depend on each other and both crates are copied to another directory.
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: