diff options
-rw-r--r-- | lib/spack/spack/build_environment.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/main.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/user_environment.py | 2 | ||||
-rw-r--r-- | share/spack/csh/spack.csh | 5 | ||||
-rwxr-xr-x | share/spack/setup-env.sh | 11 |
5 files changed, 14 insertions, 10 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 diff --git a/share/spack/csh/spack.csh b/share/spack/csh/spack.csh index 7a51050281..0df547fab6 100644 --- a/share/spack/csh/spack.csh +++ b/share/spack/csh/spack.csh @@ -29,13 +29,16 @@ ######################################################################## # Store LD_LIBRARY_PATH variables from spack shell function # This is necessary because MacOS System Integrity Protection clears -# (DY?)LD_LIBRARY_PATH variables on process start. +# variables that affect dyld on process start. if ( ${?LD_LIBRARY_PATH} ) then setenv SPACK_LD_LIBRARY_PATH $LD_LIBRARY_PATH endif if ( ${?DYLD_LIBRARY_PATH} ) then setenv SPACK_DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH endif +if ( ${?DYLD_FALLBACK_LIBRARY_PATH} ) then + setenv SPACK_DYLD_FALLBACK_LIBRARY_PATH $DYLD_FALLBACK_LIBRARY_PATH +endif # accumulate initial flags for main spack command set _sp_flags = "" diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 5968c4c016..d3aed61d1a 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -42,13 +42,10 @@ spack() { # Store LD_LIBRARY_PATH variables from spack shell function # This is necessary because MacOS System Integrity Protection clears - # (DY?)LD_LIBRARY_PATH variables on process start. - if [ -n "${LD_LIBRARY_PATH-}" ]; then - export SPACK_LD_LIBRARY_PATH=$LD_LIBRARY_PATH - fi - if [ -n "${DYLD_LIBRARY_PATH-}" ]; then - export SPACK_DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - fi + # variables that affect dyld on process start. + for var in LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH; do + eval "if [ -n \"\${${var}-}\" ]; then export SPACK_$var=\${${var}}; fi" + done # Zsh does not do word splitting by default, this enables it for this # function only |