summaryrefslogtreecommitdiff
path: root/lib/spack
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2020-04-16 10:45:01 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2020-04-16 17:23:33 -0700
commitf6d26db93949503c5ade08705b015766dc4d9f75 (patch)
treee071033d02f542ee1e3b2d38a0e9d2732667fd47 /lib/spack
parent1f5ef5c8769bd257c73592744f0a305023f142e7 (diff)
downloadspack-f6d26db93949503c5ade08705b015766dc4d9f75.tar.gz
spack-f6d26db93949503c5ade08705b015766dc4d9f75.tar.bz2
spack-f6d26db93949503c5ade08705b015766dc4d9f75.tar.xz
spack-f6d26db93949503c5ade08705b015766dc4d9f75.zip
macos: use DYLD_FALLBACK_LIBRARY_PATH instead of DYLD_LIBRARY_PATH
`DYLD_LIBRARY_PATH` can frequently break builtin macOS software when pointed at Spack libraries. This is because it takes *higher* precedence than the default library search paths, which are used by system software. `DYLD_FALLBACK_LIBRARY_PATH`, on the other hand, takes lower precedence. At first glance, this might seem bad, because the software installed by Spack in an environment needs to find *its* libraries, and it should not use the defaults. However, Spack's isntallations are always `RPATH`'d, so they do not have this problem. `DYLD_FALLBACK_LIBRARY_PATH` is thus useful for things built in an environment that need to use Spack's libraries, that don't set *their* RPATHs correctly for whatever reason. We now prefer it to `DYLD_LIBRARY_PATH` in modules and in environments because it helps a little bit, and it is much less intrusive.
Diffstat (limited to 'lib/spack')
-rw-r--r--lib/spack/spack/build_environment.py1
-rw-r--r--lib/spack/spack/main.py5
-rw-r--r--lib/spack/spack/user_environment.py2
3 files changed, 6 insertions, 2 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 4809a1010e..21ab6895ec 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -145,6 +145,7 @@ def clean_environment():
env.unset('CPATH')
env.unset('LD_RUN_PATH')
env.unset('DYLD_LIBRARY_PATH')
+ env.unset('DYLD_FALLBACK_LIBRARY_PATH')
build_lang = spack.config.get('config:build_language')
if build_lang:
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index 37345e8bc2..f6da7b0fb0 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -692,7 +692,10 @@ def main(argv=None):
# Spack clears these variables before building and installing packages,
# but needs to know the prior state for commands like `spack load` and
# `spack env activate that modify the user environment.
- for var in ('LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH'):
+ recovered_vars = (
+ 'LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH'
+ )
+ for var in recovered_vars:
stored_var_name = 'SPACK_%s' % var
if stored_var_name in os.environ:
os.environ[var] = os.environ[stored_var_name]
diff --git a/lib/spack/spack/user_environment.py b/lib/spack/spack/user_environment.py
index 5f2c1c6f50..d8bd9feff6 100644
--- a/lib/spack/spack/user_environment.py
+++ b/lib/spack/spack/user_environment.py
@@ -40,7 +40,7 @@ def prefix_inspections(platform):
if platform == 'darwin':
for subdir in ('lib', 'lib64'):
- inspections[subdir].append('DYLD_LIBRARY_PATH')
+ inspections[subdir].append('DYLD_FALLBACK_LIBRARY_PATH')
return inspections