From 6989bf9661c6a19eeb3ba296a1f44dfc3d2682c8 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 17 Feb 2025 13:22:56 +0100 Subject: [PATCH] py-petsc4py: patch again for wrong assumption on LDSHARED --- .../builtin/packages/py-petsc4py/ldshared.patch | 2 +- .../builtin/packages/py-petsc4py/ldshared_319.patch | 12 ++++++++++++ .../repos/builtin/packages/py-petsc4py/package.py | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/py-petsc4py/ldshared_319.patch diff --git a/var/spack/repos/builtin/packages/py-petsc4py/ldshared.patch b/var/spack/repos/builtin/packages/py-petsc4py/ldshared.patch index 026a48722e5..6842c5297a5 100644 --- a/var/spack/repos/builtin/packages/py-petsc4py/ldshared.patch +++ b/var/spack/repos/builtin/packages/py-petsc4py/ldshared.patch @@ -7,7 +7,7 @@ index 8a2466a5bd..73c08b923a 100644 ldflags = getenv('LDFLAGS', cflags + ' ' + (ldflags or '')) ldcmd = split_quoted(ld) + split_quoted(ldflags) - ldshared = [flg for flg in split_quoted(ldshared) if flg not in ldcmd] -+ ldshared = [flg for flg in split_quoted(ldshared) if flg not in ldcmd and (flg.find('/lib/spack/env')<0)] ++ ldshared = [flg for flg in split_quoted(ldshared) if flg not in ldcmd and (flg.find('/libexec/spack')<0)] ldshared = str.join(' ', ldshared) # def get_flags(cmd): diff --git a/var/spack/repos/builtin/packages/py-petsc4py/ldshared_319.patch b/var/spack/repos/builtin/packages/py-petsc4py/ldshared_319.patch new file mode 100644 index 00000000000..70b41693a24 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-petsc4py/ldshared_319.patch @@ -0,0 +1,12 @@ +diff --unified --recursive --no-dereference spack-src1/conf/confpetsc.py spack-src2/conf/confpetsc.py +--- spack-src1/conf/confpetsc.py 2025-02-17 13:02:08.781676798 +0100 ++++ spack-src2/conf/confpetsc.py 2025-02-17 13:03:13.024625112 +0100 +@@ -350,7 +350,7 @@ + ldshared = [ + flg + for flg in split_quoted(ldshared) +- if flg not in ldcmd and (flg.find('/lib/spack/env') < 0) ++ if flg not in ldcmd and (flg.find('/libexec/spack/') < 0) + ] + ldshared = str.join(' ', ldshared) + diff --git a/var/spack/repos/builtin/packages/py-petsc4py/package.py b/var/spack/repos/builtin/packages/py-petsc4py/package.py index f3ebe75a1c2..67ec6f840ad 100644 --- a/var/spack/repos/builtin/packages/py-petsc4py/package.py +++ b/var/spack/repos/builtin/packages/py-petsc4py/package.py @@ -93,6 +93,9 @@ class PyPetsc4py(PythonPackage): variant("mpi", default=True, description="Activates MPI support") + # Hack to fix https://github.com/spack/spack/issues/21451, where Petsc4Py expects LDSHARED + # to start with the same executable as get_config_var("CC") + patch("ldshared_319.patch", when="@3.19:") patch("ldshared.patch", when="@:3.18") depends_on("py-cython@3:", when="@3.20:", type="build")