Better error for libafl_cc when binaries are not found (#2988)

* better error when libafl_cc does not work as expected

* better msg, clippy
This commit is contained in:
Romain Malmain 2025-02-17 14:47:38 +01:00 committed by GitHub
parent d382b8381e
commit 530a3cc6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -333,20 +333,25 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
llvm_ar = Path::new(&llvm_ar_path).join("llvm-ar");
}
let mut found = true;
if !clang.exists() {
println!("cargo:warning=Failed to find clang frontend.");
return;
println!("cargo:warning=Failed to find binary: clang.");
found = false;
}
if !clangcpp.exists() {
println!("cargo:warning=Failed to find clang++ frontend.");
return;
println!("cargo:warning=Failed to find binary: clang++.");
found = false;
}
if !llvm_ar.exists() {
println!("cargo:warning=Failed to find llvm-ar archiver.");
return;
println!("cargo:warning=Failed to find binary: llvm-ar.");
found = false;
}
assert!(found, "\n\tAt least one of the LLVM dependencies could not be found.\n\tThe following search directory was considered: {}\n", bindir_path.display());
let cxxflags = if let Ok(flags) = llvm_cxxflags {
flags
} else {