From fc83b52fd95b7dde9d39b8d5faeb86c6debe1e72 Mon Sep 17 00:00:00 2001 From: ychenfo Date: Sun, 9 Jan 2022 04:23:30 +0800 Subject: [PATCH] add clang to nativeBuildInputs, fix compile error --- flake.nix | 9 +++++---- nac3core/build.rs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 5a51737b..0493cf9e 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { diff --git a/nac3core/build.rs b/nac3core/build.rs index c4dcfc8e..d7f8cb41 100644 --- a/nac3core/build.rs +++ b/nac3core/build.rs @@ -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| {