Skip to content

Commit

Permalink
Add file extension for clang in libafl_cc/build.rs (#1237)
Browse files Browse the repository at this point in the history
* Add CLANG and CLANG_PP env vars

Add CLANG and CLANG_PP env variables for Windows. Resolves issue if clang and llvm-config are not in the same location.

* Just add clang".exe" for windows

User should have llvm-config and clang.exe clang++.exe in the same directory anyways.

* Ran cargo fmt
  • Loading branch information
NeXX451 authored May 4, 2023
1 parent 6929c89 commit 53659f8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions libafl_cc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fn build_pass(

Some(r)
} else if cfg!(windows) {
let r = Command::new(bindir_path.join("clang-cl"))
let r = Command::new(bindir_path.join("clang-cl.exe"))
.arg("-v")
.args(cxxflags)
.arg(src_dir.join(src_file))
Expand Down Expand Up @@ -234,8 +234,16 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
let llvm_bindir = exec_llvm_config(&["--bindir"]);
let bindir_path = Path::new(&llvm_bindir);

let clang = bindir_path.join("clang");
let clangcpp = bindir_path.join("clang++");
let clang;
let clangcpp;

if cfg!(windows) {
clang = bindir_path.join("clang.exe");
clangcpp = bindir_path.join("clang++.exe");
} else {
clang = bindir_path.join("clang");
clangcpp = bindir_path.join("clang++");
}

if !clang.exists() {
println!("cargo:warning=Failed to find clang frontend.");
Expand Down

0 comments on commit 53659f8

Please sign in to comment.