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

View File

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