From 8b0552bc23e7ec86a02a66cd2a2558b19771c20a Mon Sep 17 00:00:00 2001 From: scheibelp Date: Mon, 5 Mar 2018 05:43:43 -0800 Subject: [PATCH] only filter compiler paths for binaries provided by the compiler (#7369) --- lib/spack/spack/mixins.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/mixins.py b/lib/spack/spack/mixins.py index d16f572a4e..d8ffc253fe 100644 --- a/lib/spack/spack/mixins.py +++ b/lib/spack/spack/mixins.py @@ -195,10 +195,15 @@ def _filter_compiler_wrappers_impl(self): x = llnl.util.filesystem.FileFilter(*abs_files) - x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs) - x.filter(os.environ['CXX'], self.compiler.cxx, **filter_kwargs) - x.filter(os.environ['F77'], self.compiler.f77, **filter_kwargs) - x.filter(os.environ['FC'], self.compiler.fc, **filter_kwargs) + replacements = [ + ('CC', self.compiler.cc), + ('CXX', self.compiler.cxx), + ('F77', self.compiler.f77), + ('FC', self.compiler.fc) + ] + for env_var, compiler_path in replacements: + if env_var in os.environ: + x.filter(os.environ[env_var], compiler_path, **filter_kwargs) # Remove this linking flag if present (it turns RPATH into RUNPATH) x.filter('-Wl,--enable-new-dtags', '', **filter_kwargs)