Skip to content

Commit 8c66db7

Browse files
authored
Unrolled build for rust-lang#123294
Rollup merge of rust-lang#123294 - Nilstrieb:reuqire-llvm-config, r=clubby789 Require LLVM_CONFIG to be set in rustc_llvm/build.rs This environment variable should always be set by bootstrap in `rustc_llvm_env`. The fallback is quite ugly and complicated, so removing it is nice. https://github.com/rust-lang/rust/blob/bf71daedc29e7a240261acd1516378047e311a6f/src/bootstrap/src/core/build_steps/compile.rs#L1166 I tried finding when this was added in git history, but it pointed all the way to "add build scripts" at which point I stopped digging more. This has always been here. cc `@nikic` `@cuviper` in case you happen to be aware of a deeper reason behind this r? bootstrap
2 parents 8d490e3 + d651bae commit 8c66db7

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

compiler/rustc_llvm/build.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,10 @@ fn main() {
112112

113113
restore_library_path();
114114

115-
let target = env::var("TARGET").expect("TARGET was not set");
116115
let llvm_config =
117-
tracked_env_var_os("LLVM_CONFIG").map(|x| Some(PathBuf::from(x))).unwrap_or_else(|| {
118-
if let Some(dir) = tracked_env_var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
119-
let to_test = dir
120-
.parent()
121-
.unwrap()
122-
.parent()
123-
.unwrap()
124-
.join(&target)
125-
.join("llvm/bin/llvm-config");
126-
if Command::new(&to_test).output().is_ok() {
127-
return Some(to_test);
128-
}
129-
}
130-
None
131-
});
116+
PathBuf::from(tracked_env_var_os("LLVM_CONFIG").expect("LLVM_CONFIG was not set"));
132117

133-
if let Some(llvm_config) = &llvm_config {
134-
println!("cargo:rerun-if-changed={}", llvm_config.display());
135-
}
136-
let llvm_config = llvm_config.unwrap_or_else(|| PathBuf::from("llvm-config"));
118+
println!("cargo:rerun-if-changed={}", llvm_config.display());
137119

138120
// Test whether we're cross-compiling LLVM. This is a pretty rare case
139121
// currently where we're producing an LLVM for a different platform than

0 commit comments

Comments
 (0)