Skip to content
/ rust Public
forked from rust-lang/rust

Commit 4f87987

Browse files
committed
bootstrap: build compiler libs with version number of libs being built
Previously, on a non-stable channel, it's possible for two builds from different versioned sources (e.g. 1.84.0 vs 1.84.1) to produce `librustc_driver*.so` with the same filename hashes. This causes problems with side-by-side installs wrt. linker search paths because 1.84.1 rustc bin and 1.84.0 may try to link to the "same" `librustc_driver*.so` (same filename hash) but fail because the contents of the so is actually different. We try to mitigate this by including the version number of artifacts being built via `__CARGO_DEFAULT_LIB_METADATA`.
1 parent f77247a commit 4f87987

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bootstrap/src/core/builder/cargo.rs

+6
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,12 @@ impl Builder<'_> {
779779
Mode::Codegen => metadata.push_str("codegen"),
780780
_ => {}
781781
}
782+
// `rustc_driver`'s version number is always `0.0.0`, which can cause linker search path
783+
// problems on side-by-side installs because we don't include the version number of the
784+
// `rustc_driver` being built. This can cause builds of different version numbers to produce
785+
// `librustc_driver*.so` artifacts that end up with identical filename hashes.
786+
metadata.push_str(&self.version);
787+
782788
cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata);
783789

784790
if cmd_kind == Kind::Clippy {

0 commit comments

Comments
 (0)