More expressive error for llvm_config version (#2376)

This commit is contained in:
Dominik Maier 2024-07-10 16:46:52 +02:00 committed by GitHub
parent 264c2f021e
commit d9a042e094
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,11 +107,13 @@ fn find_llvm_config() -> Result<String, String> {
if let Some(ver) = find_llvm_version("llvm-config".to_owned()) { if let Some(ver) = find_llvm_version("llvm-config".to_owned()) {
if ver >= rustc_llvm_ver { if ver >= rustc_llvm_ver {
return Ok("llvm-config".to_owned()); return Ok("llvm-config".to_owned());
} else {
return Err(format!("Version of llvm-config is {ver} but needs to be at least rustc's version({rustc_llvm_ver})"));
} }
} }
} }
Err("could not find llvm-config".to_owned()) Err("Could not find llvm-config".to_owned())
} }
fn exec_llvm_config(llvm_config: String, args: &[&str]) -> String { fn exec_llvm_config(llvm_config: String, args: &[&str]) -> String {
@ -165,7 +167,7 @@ fn qemu_bindgen_clang_args(
is_usermode: bool, is_usermode: bool,
) -> Vec<String> { ) -> Vec<String> {
if env::var("LLVM_CONFIG_PATH").is_err() { if env::var("LLVM_CONFIG_PATH").is_err() {
let found = find_llvm_config().expect("Cannot find a suitable llvm-config, it must be a version equal or greater than the rustc LLVM version"); let found = find_llvm_config().expect("Cannot find a suitable llvm-config, it must be a version equal or greater than the rustc LLVM version. Try specifying LLVM_CONFIG_PATH.");
env::set_var("LLVM_CONFIG_PATH", found); env::set_var("LLVM_CONFIG_PATH", found);
} }