Skip to content

Commit 8909ef0

Browse files
authored
octopus: fix build (NixOS#374380)
2 parents 9dee4ae + f6f5a87 commit 8909ef0

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

pkgs/by-name/oc/octopus/package.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ stdenv.mkDerivation rec {
4040
hash = "sha256-vG1HUkuNUZkhBumoJJy3AyFU6cZOo1YGmaOYcU6bPOM=";
4141
};
4242

43+
patches = [
44+
# Discover all MPI languages components to avoid scalpack discovery failure
45+
./scalapack-mpi-alias.patch
46+
];
47+
4348
nativeBuildInputs = [
4449
which
4550
perl
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 70d89efb5e..47ba750d7a 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -131,7 +131,7 @@ set(Octopus_ext_libs)
6+
find_package(GSL)
7+
if (OCTOPUS_MPI)
8+
set(MPI_DETERMINE_LIBRARY_VERSION ON)
9+
- find_package(MPI 3 COMPONENTS Fortran)
10+
+ find_package(MPI 3)
11+
# Further set MKL variables
12+
if (MPI_Fortran_LIBRARY_VERSION_STRING MATCHES Intel)
13+
set(MKL_MPI intelmpi CACHE STRING "Octopus: Overloaded")

pkgs/by-name/sc/scalapack/package.nix

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5+
fetchpatch,
56
cmake,
67
mpiCheckPhaseHook,
78
mpi,
@@ -18,14 +19,22 @@ stdenv.mkDerivation rec {
1819
src = fetchFromGitHub {
1920
owner = "Reference-ScaLAPACK";
2021
repo = pname;
21-
rev = "v${version}";
22-
sha256 = "sha256-KDMW/D7ubGaD2L7eTwULJ04fAYDPAKl8xKPZGZMkeik=";
22+
tag = "v${version}";
23+
hash = "sha256-KDMW/D7ubGaD2L7eTwULJ04fAYDPAKl8xKPZGZMkeik=";
2324
};
2425

2526
passthru = { inherit (blas) isILP64; };
2627

2728
__structuredAttrs = true;
2829

30+
patches = [
31+
(fetchpatch {
32+
name = "version-string";
33+
url = "https://github.com/Reference-ScaLAPACK/scalapack/commit/76cc1ed3032e9a4158a4513c9047c3746b269f04.patch";
34+
hash = "sha256-kmllLa9GUeTrHRYeS0yIk9I8LwaIoEytdyQGRuinn3A=";
35+
})
36+
];
37+
2938
# Required to activate ILP64.
3039
# See https://github.com/Reference-ScaLAPACK/scalapack/pull/19
3140
postPatch = lib.optionalString passthru.isILP64 ''
@@ -76,6 +85,14 @@ stdenv.mkDerivation rec {
7685
# sometimes fail due to this
7786
checkFlags = [ "ARGS=--timeout 10000" ];
7887

88+
postFixup = ''
89+
# _IMPORT_PREFIX, used to point to lib, points to dev output. Every package using the generated
90+
# cmake file will thus look for the library in the dev output instead of out.
91+
# Use the absolute path to $out instead to fix the issue.
92+
substituteInPlace $dev/lib/cmake/scalapack-${version}/scalapack-targets-release.cmake \
93+
--replace "\''${_IMPORT_PREFIX}" "$out"
94+
'';
95+
7996
meta = with lib; {
8097
homepage = "http://www.netlib.org/scalapack/";
8198
description = "Library of high-performance linear algebra routines for parallel distributed memory machines";

0 commit comments

Comments
 (0)