From 8a65fe8da6433092ff21b34f17473535e3c189da Mon Sep 17 00:00:00 2001 From: Jack Coughlin Date: Sat, 18 Jul 2020 08:47:24 -0700 Subject: [PATCH] petsc: Fix install_name_tool patch The PETSc library's config/install.py script checks whether /usr/bin/install_name_tool is an existing file: https://gitlab.com/petsc/petsc/-/blob/master/config/install.py#L368 Therefore, it is not enough to replace it with something that we expect to be on the PATH, as this will cause the linked if statement to be silently skipped. The consequence is that applications linked against this version of petsc will fail at runtime on MacOS with a dynamic loading error. Instead, we should replace install_name_tool with the absolute path of a binary we know will be present at build time. Note that this should be fixed upstream as well, but this is sufficient to fix the runtime error. --- pkgs/development/libraries/science/math/petsc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix index a4d0850c77f7..dd3d6ab787fe 100644 --- a/pkgs/development/libraries/science/math/petsc/default.nix +++ b/pkgs/development/libraries/science/math/petsc/default.nix @@ -1,4 +1,4 @@ -{ stdenv , fetchurl , blas , gfortran , lapack , python }: +{ stdenv , darwin , fetchurl , blas , gfortran , lapack , python }: stdenv.mkDerivation rec { pname = "petsc"; @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { --replace /bin/sh /usr/bin/python '' + stdenv.lib.optionalString stdenv.isDarwin '' substituteInPlace config/install.py \ - --replace /usr/bin/install_name_tool install_name_tool + --replace /usr/bin/install_name_tool ${darwin.cctools}/bin/install_name_tool ''; preConfigure = ''