summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
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),
]