summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>2020-06-24 17:39:04 +0200
committerGitHub <noreply@github.com>2020-06-24 10:39:04 -0500
commitbc53bb9b7cbf250c98cfe77d334ed30d6b958c21 (patch)
tree066ec86dc165fafaaceed509461ada39f53010ae /lib
parentec58f28c209d1ffef51424b5d1423aa219c143a4 (diff)
downloadspack-bc53bb9b7cbf250c98cfe77d334ed30d6b958c21.tar.gz
spack-bc53bb9b7cbf250c98cfe77d334ed30d6b958c21.tar.bz2
spack-bc53bb9b7cbf250c98cfe77d334ed30d6b958c21.tar.xz
spack-bc53bb9b7cbf250c98cfe77d334ed30d6b958c21.zip
Unset environment variables that are most commonly used by Autotools packages. (#8623)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py12
-rw-r--r--lib/spack/spack/util/environment.py2
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index f997110b4c..8a063377a7 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -162,6 +162,18 @@ def clean_environment():
if 'PKGCONF' in varname:
env.unset(varname)
+ # Unset the following variables because they can affect installation of
+ # Autotools and CMake packages.
+ build_system_vars = [
+ 'CC', 'CFLAGS', 'CPP', 'CPPFLAGS', # C variables
+ 'CXX', 'CCC', 'CXXFLAGS', 'CXXCPP', # C++ variables
+ 'F77', 'FFLAGS', 'FLIBS', # Fortran77 variables
+ 'FC', 'FCFLAGS', 'FCLIBS', # Fortran variables
+ 'LDFLAGS', 'LIBS' # linker variables
+ ]
+ for v in build_system_vars:
+ env.unset(v)
+
build_lang = spack.config.get('config:build_language')
if build_lang:
# Override language-related variables. This can be used to force
diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py
index 8069f51431..3d69efa5ca 100644
--- a/lib/spack/spack/util/environment.py
+++ b/lib/spack/spack/util/environment.py
@@ -376,7 +376,7 @@ class EnvironmentModifications(object):
"""Stores a request to unset an environment variable.
Args:
- name: name of the environment variable to be set
+ name: name of the environment variable to be unset
"""
kwargs.update(self._get_outside_caller_attributes())
item = UnsetEnv(name, **kwargs)