diff options
author | Valentin Volkl <valentin.volkl@cern.ch> | 2021-11-09 11:16:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 11:16:42 +0100 |
commit | a3dd0e78613f1016bbd35e4dabcf95ea63616788 (patch) | |
tree | 378e5a849ee124a9716272dc7688dfdf35730640 /lib | |
parent | abdd206f652b1c9135f874452eecb5b0de9ec40c (diff) | |
download | spack-a3dd0e78613f1016bbd35e4dabcf95ea63616788.tar.gz spack-a3dd0e78613f1016bbd35e4dabcf95ea63616788.tar.bz2 spack-a3dd0e78613f1016bbd35e4dabcf95ea63616788.tar.xz spack-a3dd0e78613f1016bbd35e4dabcf95ea63616788.zip |
build_environment: clean *_ROOT variables (#26474)
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_environment.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 83aa634276..fa1ad76274 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -185,6 +185,13 @@ def clean_environment(): env.unset('LD_PRELOAD') env.unset('DYLD_INSERT_LIBRARIES') + # Avoid <packagename>_ROOT user variables overriding spack dependencies + # https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html + # Spack needs SPACK_ROOT though, so we need to exclude that + for varname in os.environ.keys(): + if varname.endswith('_ROOT') and varname != 'SPACK_ROOT': + env.unset(varname) + # On Cray "cluster" systems, unset CRAY_LD_LIBRARY_PATH to avoid # interference with Spack dependencies. # CNL requires these variables to be set (or at least some of them, |