summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorDom Heinzeller <dom.heinzeller@icloud.com>2022-11-04 12:52:27 -0600
committerGitHub <noreply@github.com>2022-11-04 11:52:27 -0700
commit33e5e772253d2a8ad3836760a96ac7baf4d73d17 (patch)
tree4fc58aa1f581e9dd1c07d556c34cdfc9195c9dcf /var
parent13565df027bb20b1f7de878b0adb9efa3547c1c2 (diff)
downloadspack-33e5e772253d2a8ad3836760a96ac7baf4d73d17.tar.gz
spack-33e5e772253d2a8ad3836760a96ac7baf4d73d17.tar.bz2
spack-33e5e772253d2a8ad3836760a96ac7baf4d73d17.tar.xz
spack-33e5e772253d2a8ad3836760a96ac7baf4d73d17.zip
Python package: fix .libs on macOS with external Python (#33410)
For some instances of externally-provided Python (e.g. Homebrew), the LDLIBRARY/LIBRARY config variables don't actually refer to libraries and should therefore be excluded from ".libs".
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/python/package.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 8a69efbbda..3fea87a2ec 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -1250,12 +1250,29 @@ config.update(get_paths())
# The values of LDLIBRARY and LIBRARY aren't reliable. Intel Python uses a
# static binary but installs shared libraries, so sysconfig reports
# libpythonX.Y.a but only libpythonX.Y.so exists. So we add our own paths, too.
- shared_libs = [
- self.config_vars["LDLIBRARY"],
+
+ # With framework python on macOS, self.config_vars["LDLIBRARY"] can point
+ # to a library that is not linkable because it does not have the required
+ # suffix of a shared library (it is called "Python" without extention).
+ # The linker then falls back to libPython.tbd in the default macOS
+ # software tree, which security settings prohibit to link against
+ # (your binary is not an allowed client of /path/to/libPython.tbd).
+ # To avoid this, we replace the entry in config_vars with a default value.
+ file_extension_shared = os.path.splitext(self.config_vars["LDLIBRARY"])[-1]
+ if file_extension_shared == "":
+ shared_libs = []
+ else:
+ shared_libs = [self.config_vars["LDLIBRARY"]]
+ shared_libs += [
"{}python{}.{}".format(lib_prefix, py_version, dso_suffix),
]
- static_libs = [
- self.config_vars["LIBRARY"],
+ # Like LDLIBRARY for Python on Mac OS, LIBRARY may refer to an un-linkable object
+ file_extension_static = os.path.splitext(self.config_vars["LIBRARY"])[-1]
+ if file_extension_static == "":
+ static_libs = []
+ else:
+ static_libs = [self.config_vars["LIBRARY"]]
+ static_libs += [
"{}python{}.{}".format(lib_prefix, py_version, stat_suffix),
]