Non-reproducible builds depending on the compiling OS #71361
Labels
A-reproducibility
Area: Reproducible / deterministic builds
C-bug
Category: This is a bug.
T-cargo
Relevant to the cargo team, which will review and decide on the PR/issue.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Tock is an operating system written in Rust for embedded platforms (e.g. Cortex-M, RISC-V). We've been trying to make builds reproducible, with good progress (tock/tock#1666). In particular:
--remap-path-prefix
,cargo rustc
to avoid passing custom linker arguments (that include paths on the filesystem) to the dependencies.This allows reproducibility of the builds on various Linux machines.
However, the builds are different on MacOS, as evidenced by CI on a GitHub workflow (google/OpenSK#94 (comment)).
In particular, the issue seems to stem from a different
-C metadata=
(and-C extra-filename=
) passed torustc
(while the steps that I mentioned above make sure that the samemetadata
hash is passed across Linux machines for each crate in the project).These are built with the
--verbose
parameter passed tocargo
, and an examplerustc
invocation is the following (tock_cells
crate of the Tock project). Do you have any idea of which invocation parameter could cause themetadata
to be different?rustc --crate-name tock_cells libraries/tock-cells/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=z -C panic=abort -C debuginfo=2 -C metadata=92487154152022d3 -C extra-filename=-92487154152022d3 --out-dir /home/runner/work/OpenSK/OpenSK/third_party/tock/target/thumbv7em-none-eabi/release/deps --target thumbv7em-none-eabi -L dependency=/home/runner/work/OpenSK/OpenSK/third_party/tock/target/thumbv7em-none-eabi/release/deps -L dependency=/home/runner/work/OpenSK/OpenSK/third_party/tock/target/release/deps -C link-arg=-Tlayout.ld -C linker=rust-lld -C linker-flavor=ld.lld -C relocation-model=dynamic-no-pic -C link-arg=-zmax-page-size=512 -C link-arg=-icf=all --remap-path-prefix=/home/runner/work/OpenSK/OpenSK/third_party/tock/= -D warnings
rustc --crate-name tock_cells libraries/tock-cells/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=z -C panic=abort -C debuginfo=2 -C metadata=9fc982d890c0358d -C extra-filename=-9fc982d890c0358d --out-dir /Users/runner/runners/2.169.0/work/OpenSK/OpenSK/third_party/tock/target/thumbv7em-none-eabi/release/deps --target thumbv7em-none-eabi -L dependency=/Users/runner/runners/2.169.0/work/OpenSK/OpenSK/third_party/tock/target/thumbv7em-none-eabi/release/deps -L dependency=/Users/runner/runners/2.169.0/work/OpenSK/OpenSK/third_party/tock/target/release/deps -C link-arg=-Tlayout.ld -C linker=rust-lld -C linker-flavor=ld.lld -C relocation-model=dynamic-no-pic -C link-arg=-zmax-page-size=512 -C link-arg=-icf=all --remap-path-prefix=/Users/runner/runners/2.169.0/work/OpenSK/OpenSK/third_party/tock/= -D warnings
This could be relevant to #34902, although this issue is more specific.
The text was updated successfully, but these errors were encountered: