diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2017-11-02 09:19:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 09:19:23 -0700 |
commit | c96f2e50a6d91cda445721d3c82710df13aae4c6 (patch) | |
tree | e1e6b705ef8aff85f67b4252e66a3825e2ecf14a | |
parent | c4db3d384ecd7b75ebf92a5ea0f3740c5137a8ab (diff) | |
download | spack-c96f2e50a6d91cda445721d3c82710df13aae4c6.tar.gz spack-c96f2e50a6d91cda445721d3c82710df13aae4c6.tar.bz2 spack-c96f2e50a6d91cda445721d3c82710df13aae4c6.tar.xz spack-c96f2e50a6d91cda445721d3c82710df13aae4c6.zip |
Only use XCode clang wrappers for packages that set use_xcode=True (#6077)
-rw-r--r-- | lib/spack/spack/compiler.py | 12 | ||||
-rw-r--r-- | lib/spack/spack/compilers/clang.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/environment.py | 4 |
3 files changed, 11 insertions, 23 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index a16120aaa5..6419a19a12 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -125,7 +125,6 @@ class Compiler(object): def check(exe): if exe is None: return None - exe = self._find_full_path(exe) _verify_executables(exe) return exe @@ -286,17 +285,6 @@ class Compiler(object): successful.reverse() return dict(((v, p, s), path) for v, p, s, path in successful) - def _find_full_path(self, path): - """Return the actual path for a tool. - - Some toolchains use forwarding executables (particularly Xcode-based - toolchains) which can be manipulated by external environment variables. - This method should be used to extract the actual path used for a tool - by finding out the end executable the forwarding executables end up - running. - """ - return path - def setup_custom_environment(self, pkg, env): """Set any environment variables necessary to use the compiler.""" pass diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 5a88897b68..2a4737f56f 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -158,16 +158,6 @@ class Clang(Compiler): return _version_cache[comp] - def _find_full_path(self, path): - basename = os.path.basename(path) - - if not self.is_apple or basename not in ('clang', 'clang++'): - return super(Clang, self)._find_full_path(path) - - xcrun = Executable('xcrun') - full_path = xcrun('-f', basename, output=str) - return full_path.strip() - @classmethod def fc_version(cls, fc): # We could map from gcc/gfortran version to clang version, but on macOS @@ -202,6 +192,14 @@ class Clang(Compiler): # consequently render MPI non-functional outside of Spack. return + # Use special XCode versions of compiler wrappers when using XCode + # Overwrites build_environment's setting of SPACK_CC and SPACK_CXX + xcrun = Executable('xcrun') + xcode_clang = xcrun('-f', 'clang', output=str).strip() + xcode_clangpp = xcrun('-f', 'clang++', output=str).strip() + env.set('SPACK_CC', xcode_clang, force=True) + env.set('SPACK_CXX', xcode_clangpp, force=True) + xcode_select = Executable('xcode-select') # Get the path of the active developer directory diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 72bbc98625..f217de6d9c 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -460,7 +460,9 @@ def set_or_unset_not_first(variable, changes, errstream): modifications have already been requested. """ indexes = [ii for ii, item in enumerate(changes) - if ii != 0 and type(item) in [SetEnv, UnsetEnv]] + if ii != 0 and + not item.args.get('force', False) and + type(item) in [SetEnv, UnsetEnv]] if indexes: good = '\t \t{context} at {filename}:{lineno}' nogood = '\t--->\t{context} at {filename}:{lineno}' |