From 53659f8a5c315e6d46e01211ba1de93385089f02 Mon Sep 17 00:00:00 2001 From: Tomas Duchac Date: Thu, 4 May 2023 09:52:51 +0000 Subject: [PATCH] Add file extension for clang in libafl_cc/build.rs (#1237) * 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 --- libafl_cc/build.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libafl_cc/build.rs b/libafl_cc/build.rs index fef32e90bd..834e6f6c9d 100644 --- a/libafl_cc/build.rs +++ b/libafl_cc/build.rs @@ -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)) @@ -234,8 +234,16 @@ pub const LIBAFL_CC_LLVM_VERSION: Option = 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.");