add clang to nativeBuildInputs, fix compile error

This commit is contained in:
ychenfo 2022-01-09 04:23:30 +08:00
parent 4760851638
commit fc83b52fd9
2 changed files with 7 additions and 5 deletions

View File

@ -54,7 +54,7 @@
name = "nac3artiq";
src = self;
cargoLock = { lockFile = ./Cargo.lock; };
nativeBuildInputs = [ pkgs.python3 llvm-nac3 ];
nativeBuildInputs = [ pkgs.python3 llvm-nac3 pkgs.llvmPackages_13.clang-unwrapped ];
buildInputs = [ pkgs.python3 llvm-nac3 ];
cargoBuildFlags = [ "--package" "nac3artiq" ];
cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ];
@ -81,7 +81,7 @@
name = "nac3artiq-instrumented";
src = self;
cargoLock = { lockFile = ./Cargo.lock; };
nativeBuildInputs = [ pkgs.python3 llvm-nac3-instrumented ];
nativeBuildInputs = [ pkgs.python3 llvm-nac3-instrumented pkgs.llvmPackages_13.clang-unwrapped ];
buildInputs = [ pkgs.python3 llvm-nac3-instrumented ];
cargoBuildFlags = [ "--package" "nac3artiq" "--features" "init-llvm-profile" ];
doCheck = false;
@ -119,7 +119,7 @@
name = "nac3artiq-pgo";
src = self;
cargoLock = { lockFile = ./Cargo.lock; };
nativeBuildInputs = [ pkgs.python3 llvm-nac3-pgo ];
nativeBuildInputs = [ pkgs.python3 llvm-nac3-pgo pkgs.llvmPackages_13.clang-unwrapped ];
buildInputs = [ pkgs.python3 llvm-nac3-pgo ];
cargoBuildFlags = [ "--package" "nac3artiq" ];
cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ];
@ -140,7 +140,7 @@
name = "nac3artiq";
src = self;
cargoLock = { lockFile = ./Cargo.lock; };
nativeBuildInputs = [ pkgs.zip ];
nativeBuildInputs = [ pkgs.zip pkgs.llvmPackages_13.clang-unwrapped ];
buildInputs = [ pkgs-mingw.zlib ];
configurePhase =
''
@ -185,6 +185,7 @@
clippy
(packages.x86_64-linux.python3-mimalloc.withPackages(ps: [ ps.numpy ]))
];
UNWRAPPED_CLANG = "${pkgs.llvmPackages_13.clang-unwrapped}/bin/clang";
};
hydraJobs = {

View File

@ -10,6 +10,7 @@ fn main() {
const FILE: &str = "src/codegen/irrt/irrt.c";
println!("cargo:rerun-if-changed={}", FILE);
const FLAG: &[&str] = &[
"--target=wasm32",
FILE,
"-O3",
"-emit-llvm",
@ -20,7 +21,7 @@ fn main() {
"-o",
"-",
];
let output = Command::new("clang")
let output = Command::new(env::var("UNWRAPPED_CLANG").unwrap_or_else(|_| "clang".into()))
.args(FLAG)
.output()
.map(|o| {