build_environment: clean *_ROOT variables (#26474)

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
This commit is contained in:
Valentin Volkl 2021-11-09 11:16:42 +01:00 committed by GitHub
parent abdd206f65
commit a3dd0e7861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,6 +185,13 @@ def clean_environment():
env.unset('LD_PRELOAD') env.unset('LD_PRELOAD')
env.unset('DYLD_INSERT_LIBRARIES') 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 # On Cray "cluster" systems, unset CRAY_LD_LIBRARY_PATH to avoid
# interference with Spack dependencies. # interference with Spack dependencies.
# CNL requires these variables to be set (or at least some of them, # CNL requires these variables to be set (or at least some of them,