diff options
author | Greg Becker <becker33@llnl.gov> | 2024-05-23 17:13:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-24 00:13:36 +0000 |
commit | b61bae7640c694fc82238f9bc0dc86947f837d57 (patch) | |
tree | 070cd8aa68a10a62f20a3b82a55b8acc9fa682e0 /lib | |
parent | 8b7abace8b444786a4fcc62a36ff5dc34134b070 (diff) | |
download | spack-b61bae7640c694fc82238f9bc0dc86947f837d57.tar.gz spack-b61bae7640c694fc82238f9bc0dc86947f837d57.tar.bz2 spack-b61bae7640c694fc82238f9bc0dc86947f837d57.tar.xz spack-b61bae7640c694fc82238f9bc0dc86947f837d57.zip |
bugfix: external detection for compilers with os but not target (#44156)
avoid calling `spec.target` when None.
When an external compiler package has an `os` set but no `target` set, Spack
currently falls into a codepath that calls `spec.target` (which itself calls
`spec.architecture.target.Microarchitecture`) when `spec.architecture.target`
is None, throwing an error.
e.g.
```
packages:
gcc:
externals:
- spec: gcc@12.3.1 os=rhel7
prefix: /usr
```
---------
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/compilers/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index 8ce9d81120..88e5e7b998 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -220,10 +220,10 @@ def _compiler_config_from_external(config): operating_system = host_platform.operating_system("default_os") target = host_platform.target("default_target").microarchitecture else: - target = spec.target + target = spec.architecture.target if not target: - host_platform = spack.platforms.host() - target = host_platform.target("default_target").microarchitecture + target = spack.platforms.host().target("default_target") + target = target.microarchitecture operating_system = spec.os if not operating_system: |