From cee62aa6c5bd9e365bd9b1a3a893ebac1075159e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 25 Nov 2023 20:15:29 +0800 Subject: [PATCH] pin down LLVM used for IRRT --- flake.nix | 16 ++++++++++------ nac3core/build.rs | 4 ++-- nix/windows/default.nix | 11 ++++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 5fe46f1c..414b3e8c 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,12 @@ in rec { packages.x86_64-linux = rec { llvm-nac3 = pkgs.callPackage ./nix/llvm {}; - clang-unwrapped = pkgs.runCommandNoCC "clang-unwrapped" {} "mkdir -p $out/bin; ln -s ${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang $out/bin/clang-unwrapped"; + llvm-tools-irrt = pkgs.runCommandNoCC "llvm-tools-irrt" {} + '' + mkdir -p $out/bin + ln -s ${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang $out/bin/clang-irrt + ln -s ${pkgs.llvmPackages_14.llvm.out}/bin/llvm-as $out/bin/llvm-as-irrt + ''; nac3artiq = pkgs.python3Packages.toPythonModule ( pkgs.rustPlatform.buildRustPackage rec { name = "nac3artiq"; @@ -19,7 +24,7 @@ lockFile = ./Cargo.lock; }; passthru.cargoLock = cargoLock; - nativeBuildInputs = [ pkgs.python3 pkgs.llvmPackages_14.clang packages.x86_64-linux.clang-unwrapped pkgs.llvmPackages_14.llvm.out llvm-nac3 ]; + nativeBuildInputs = [ pkgs.python3 pkgs.llvmPackages_14.clang llvm-tools-irrt pkgs.llvmPackages_14.llvm.out llvm-nac3 ]; buildInputs = [ pkgs.python3 llvm-nac3 ]; checkInputs = [ (pkgs.python3.withPackages(ps: [ ps.numpy ps.scipy ])) ]; checkPhase = @@ -61,7 +66,7 @@ name = "nac3artiq-instrumented"; src = self; inherit (nac3artiq) cargoLock; - nativeBuildInputs = [ pkgs.python3 packages.x86_64-linux.clang-unwrapped pkgs.llvmPackages_14.llvm.out llvm-nac3-instrumented ]; + nativeBuildInputs = [ pkgs.python3 packages.x86_64-linux.llvm-tools-irrt llvm-nac3-instrumented ]; buildInputs = [ pkgs.python3 llvm-nac3-instrumented ]; cargoBuildFlags = [ "--package" "nac3artiq" "--features" "init-llvm-profile" ]; doCheck = false; @@ -123,7 +128,7 @@ name = "nac3artiq-pgo"; src = self; inherit (nac3artiq) cargoLock; - nativeBuildInputs = [ pkgs.python3 packages.x86_64-linux.clang-unwrapped pkgs.llvmPackages_14.llvm.out llvm-nac3-pgo ]; + nativeBuildInputs = [ pkgs.python3 packages.x86_64-linux.llvm-tools-irrt llvm-nac3-pgo ]; buildInputs = [ pkgs.python3 llvm-nac3-pgo ]; cargoBuildFlags = [ "--package" "nac3artiq" ]; cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ]; @@ -145,8 +150,7 @@ # build dependencies packages.x86_64-linux.llvm-nac3 llvmPackages_14.clang # demo - packages.x86_64-linux.clang-unwrapped # IRRT - pkgs.llvmPackages_14.llvm.out # IRRT + packages.x86_64-linux.llvm-tools-irrt cargo rustc # runtime dependencies diff --git a/nac3core/build.rs b/nac3core/build.rs index 304d6026..fb9f473f 100644 --- a/nac3core/build.rs +++ b/nac3core/build.rs @@ -29,7 +29,7 @@ fn main() { "-o", "-", ]; - let output = Command::new("clang-unwrapped") + let output = Command::new("clang-irrt") .args(FLAG) .output() .map(|o| { @@ -61,7 +61,7 @@ fn main() { file.write_all(filtered_output.as_bytes()).unwrap(); } - let mut llvm_as = Command::new("llvm-as") + let mut llvm_as = Command::new("llvm-as-irrt") .stdin(Stdio::piped()) .arg("-o") .arg(out_path.join("irrt.bc")) diff --git a/nix/windows/default.nix b/nix/windows/default.nix index 8adf0737..c7709fd6 100644 --- a/nix/windows/default.nix +++ b/nix/windows/default.nix @@ -77,7 +77,12 @@ in rec { ''; dontFixup = true; }; - clang-unwrapped = pkgs.runCommandNoCC "clang-unwrapped" {} "mkdir -p $out/bin; ln -s ${llvm-nac3}/bin/clang.exe $out/bin/clang-unwrapped.exe"; + llvm-tools-irrt = pkgs.runCommandNoCC "llvm-tools-irrt" {} + '' + mkdir -p $out/bin + ln -s ${llvm-nac3}/bin/clang.exe $out/bin/clang-irrt.exe + ln -s ${llvm-nac3}/bin/llvm-as.exe $out/bin/llvm-as-irrt.exe + ''; nac3artiq = pkgs.rustPlatform.buildRustPackage { name = "nac3artiq-msys2"; src = ../../.; @@ -89,7 +94,7 @@ in rec { '' export HOME=`mktemp -d` export WINEDEBUG=-all - export WINEPATH=Z:${msys2-env}/clang64/bin\;Z:${llvm-nac3}/bin\;Z:${clang-unwrapped}/bin + export WINEPATH=Z:${msys2-env}/clang64/bin\;Z:${llvm-nac3}/bin\;Z:${llvm-tools-irrt}/bin ${silenceFontconfig} export PYO3_CONFIG_FILE=Z:${pyo3-mingw-config} export CC=clang @@ -130,7 +135,7 @@ in rec { wine-msys2 = pkgs.writeShellScriptBin "wine-msys2" '' export WINEDEBUG=-all - export WINEPATH=Z:${msys2-env}/clang64/bin\;Z:${llvm-nac3}/bin\;Z:${clang-unwrapped}/bin + export WINEPATH=Z:${msys2-env}/clang64/bin\;Z:${llvm-nac3}/bin\;Z:${llvm-tools-irrt}/bin export PYO3_CONFIG_FILE=Z:${pyo3-mingw-config} exec ${pkgs.wineWowPackages.stable}/bin/wine64 cmd '';