diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2021-02-17 17:54:50 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-17 15:54:50 -0800 |
commit | d04f9a1ae3390103db70f6a60cae71598fc8dc40 (patch) | |
tree | 04b2f844ff6095a1f3e7049d25d6e3b15271f7f8 /lib | |
parent | c11c5df738af8f9b6a9c50f620f3f4a806fb87ec (diff) | |
download | spack-d04f9a1ae3390103db70f6a60cae71598fc8dc40.tar.gz spack-d04f9a1ae3390103db70f6a60cae71598fc8dc40.tar.bz2 spack-d04f9a1ae3390103db70f6a60cae71598fc8dc40.tar.xz spack-d04f9a1ae3390103db70f6a60cae71598fc8dc40.zip |
apple-clang: add correct path to compiler wrappers (#21662)
Follow-up to #17110
### Before
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/apple-clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```
### After
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```
`CC` and `SPACK_CC` were being set correctly, but `PATH` was using the name of the compiler `apple-clang` instead of `clang`. For most packages, since `CC` was set correctly, nothing broke. But for packages using `Makefiles` that set `CC` based on `which clang`, it was using the system compilers instead of the compiler wrappers. Discovered when working on `py-xgboost@0.90`.
An alternative fix would be to copy the symlinks in `env/clang` to `env/apple-clang`. Let me know if you think there's a better way to do this, or to test this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_environment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index d023365bba..f7fd76d82a 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -417,7 +417,7 @@ def set_build_environment_variables(pkg, env, dirty): # directory. Add that to the path too. env_paths = [] compiler_specific = os.path.join( - spack.paths.build_env_path, pkg.compiler.name) + spack.paths.build_env_path, os.path.dirname(pkg.compiler.link_paths['cc'])) for item in [spack.paths.build_env_path, compiler_specific]: env_paths.append(item) ci = os.path.join(item, 'case-insensitive') |