Skip to content
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

Rebuild llvm spuriously less frequently #138333

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,19 @@ impl Builder<'_> {
// needs to not accidentally link to libLLVM in stage0/lib.
cargo.env("REAL_LIBRARY_PATH_VAR", helpers::dylib_path_var());
if let Some(e) = env::var_os(helpers::dylib_path_var()) {
cargo.env("REAL_LIBRARY_PATH", e);
// We only need the original LIBRARY_PATH when using system llvm. In all other cases, we can
// just discard it. This is useful because rust-analyzer sometimes has a different
// LIBRARY_PATH than a baseline environment, causing spurious rebuilds.
let ci_llvm = self.config.llvm_from_ci && target == self.build.build;
let prebuilt_llvm = self
.config
.target_config
.get(&target)
.and_then(|conf| conf.llvm_config.as_ref())
.is_some();
if prebuilt_llvm && !ci_llvm {
cargo.env("REAL_LIBRARY_PATH", e);
}
}

// Set a flag for `check`/`clippy`/`fix`, so that certain build
Expand Down
Loading