From 169ec60e7173651ef5489ac7936928d6eb65384f Mon Sep 17 00:00:00 2001 From: Aleix Roca Nonell Date: Mon, 26 May 2025 10:29:16 +0200 Subject: [PATCH] Fix C runtime objects path Some gcc versions append an extension to the patch version number, but this extension is not part of the installation path. This patch removes the extension to the patch version. --- pkgs/llvm-ompss2/default.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/llvm-ompss2/default.nix b/pkgs/llvm-ompss2/default.nix index 81b972a..1b53de3 100644 --- a/pkgs/llvm-ompss2/default.nix +++ b/pkgs/llvm-ompss2/default.nix @@ -9,12 +9,14 @@ , ompss2rt ? null }: +with lib; + let usingNodesAndOmpv = (openmp.pname == "openmp-v" && ompss2rt.pname == "nodes"); sameNosv = openmp.nosv == ompss2rt.nosv; in -assert lib.assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V"; +assert assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V"; let homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME"; @@ -34,14 +36,15 @@ let targetConfig = stdenv.targetPlatform.config; inherit gcc; cc = clangOmpss2Unwrapped; + gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)]; in wrapCCWith { inherit cc bintools; # extraPackages adds packages to depsTargetTargetPropagated - extraPackages = lib.optional (openmp != null) openmp; + extraPackages = optional (openmp != null) openmp; extraBuildCommands = '' echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags - echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags - echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags + echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-cflags + echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-ldflags echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags for dir in ${gcc.cc}/include/c++/*; do @@ -55,12 +58,12 @@ in wrapCCWith { wrap clang++ $wrapper $ccPath/clang++ - '' + lib.optionalString (openmp != null) '' + '' + optionalString (openmp != null) '' echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook - '' + lib.optionalString (ompss2rt != null) '' + '' + optionalString (ompss2rt != null) '' echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook - '' + lib.optionalString (ompss2rt != null && ompss2rt.pname == "nodes") '' + '' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") '' echo "export NOSV_HOME=${ompss2rt.nosv}" >> $out/nix-support/cc-wrapper-hook ''; }