diff --git a/pkgs/development/libraries/mpich/default.nix b/pkgs/development/libraries/mpich/default.nix index f53a3268b739..d3bc279506f9 100644 --- a/pkgs/development/libraries/mpich/default.nix +++ b/pkgs/development/libraries/mpich/default.nix @@ -36,14 +36,16 @@ stdenv.mkDerivation rec { "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300 "FCFLAGS=-fallow-argument-mismatch" ] ++ lib.optionals pmixSupport [ - "--with-pmix=${lib.getDev pmix}" + "--with-pmix" ]; enableParallelBuilding = true; nativeBuildInputs = [ gfortran python3 ]; buildInputs = [ perl openssh hwloc ] - ++ lib.optional (!stdenv.isDarwin) ch4backend; + ++ lib.optional (!stdenv.isDarwin) ch4backend + ++ lib.optional pmixSupport pmix; + doCheck = true; diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index f5fb65f7989b..78605179f710 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -1,5 +1,7 @@ { lib, stdenv, fetchFromGitHub, perl, autoconf, automake -, libtool, python3, flex, libevent, hwloc, munge, zlib, pandoc, gitMinimal +, removeReferencesTo, libtool, python3, flex, libevent +, targetPackages, makeWrapper +, hwloc, munge, zlib, pandoc, gitMinimal } : stdenv.mkDerivation rec { @@ -14,6 +16,8 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + outputs = [ "out" "dev" ]; + postPatch = '' patchShebangs ./autogen.pl patchShebangs ./config @@ -28,6 +32,8 @@ stdenv.mkDerivation rec { flex gitMinimal python3 + removeReferencesTo + makeWrapper ]; buildInputs = [ libevent hwloc munge zlib ]; @@ -46,6 +52,27 @@ stdenv.mkDerivation rec { postInstall = '' find $out/lib/ -name "*.la" -exec rm -f \{} \; + + moveToOutput "bin/pmix_info" "''${!outputDev}" + moveToOutput "bin/pmixcc" "''${!outputDev}" + moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}" + + # The path to the pmixcc-wrapper-data.txt is hard coded and + # points to $out instead of dev. Use wrapper to fix paths. + wrapProgram $dev/bin/pmixcc \ + --set PMIX_INCLUDEDIR $dev/include \ + --set PMIX_PKGDATADIR $dev/share/pmix + ''; + + postFixup = '' + # The build info (parameters to ./configure) are hardcoded + # into the library. This clears all references to $dev/include. + remove-references-to -t $dev $(readlink -f $out/lib/libpmix.so) + + # Pin the compiler to the current version in a cross compiler friendly way. + # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). + sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \ + $dev/share/pmix/pmixcc-wrapper-data.txt ''; enableParallelBuilding = true; diff --git a/pkgs/servers/computing/slurm/default.nix b/pkgs/servers/computing/slurm/default.nix index 6e2b2e62d3b6..08fdbcebb016 100644 --- a/pkgs/servers/computing/slurm/default.nix +++ b/pkgs/servers/computing/slurm/default.nix @@ -37,6 +37,13 @@ stdenv.mkDerivation rec { prePatch = '' substituteInPlace src/common/env.c \ --replace "/bin/echo" "${coreutils}/bin/echo" + + # Autoconf does not support split packages for pmix (libs and headers). + # Fix the path to the pmix libraries, so dlopen can find it. + substituteInPlace src/plugins/mpi/pmix/mpi_pmix.c \ + --replace 'xstrfmtcat(full_path, "%s/", PMIXP_LIBPATH)' \ + 'xstrfmtcat(full_path, "${lib.getLib pmix}/lib/")' + '' + (lib.optionalString enableX11 '' substituteInPlace src/common/x11_util.c \ --replace '"/usr/bin/xauth"' '"${xorg.xauth}/bin/xauth"' @@ -68,7 +75,7 @@ stdenv.mkDerivation rec { "--with-yaml=${lib.getDev libyaml}" "--with-ofed=${lib.getDev rdma-core}" "--sysconfdir=/etc/slurm" - "--with-pmix=${pmix}" + "--with-pmix=${lib.getDev pmix}" "--with-bpf=${libbpf}" "--without-rpath" # Required for configure to pick up the right dlopen path ] ++ (optional enableGtk2 "--disable-gtktest")