diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-04-19 00:47:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 15:47:52 -0700 |
commit | d92c21ec9709589e20abdd4eaadcda0697a594ed (patch) | |
tree | e53a094e8aa01851e8eec66ca726c8d114f753cf /lib | |
parent | 5960d74dca26f5f6ac5e735f38bdc872d07dc2fb (diff) | |
download | spack-d92c21ec9709589e20abdd4eaadcda0697a594ed.tar.gz spack-d92c21ec9709589e20abdd4eaadcda0697a594ed.tar.bz2 spack-d92c21ec9709589e20abdd4eaadcda0697a594ed.tar.xz spack-d92c21ec9709589e20abdd4eaadcda0697a594ed.zip |
Fix compilation on Cray (target: any) (#37011)
fixes #36628
Fix using compilers that declare "target: any" in their
configuration. This should happen only on Cray with the
module based programming environment.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/solver/asp.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 8e843d60eb..7c5d409ca0 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -968,6 +968,9 @@ class SpackSolverSetup(object): if compiler.operating_system: self.gen.fact(fn.compiler_os(compiler_id, compiler.operating_system)) + if compiler.target == "any": + compiler.target = None + if compiler.target is not None: self.gen.fact(fn.compiler_target(compiler_id, compiler.target)) diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index bf492b93d1..8671e5288f 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -2150,3 +2150,29 @@ class TestConcretize(object): spack.config.set("compilers", compiler_configuration) s = spack.spec.Spec("a %gcc@foo").concretized() assert s.compiler.version == ver("foo") + + @pytest.mark.regression("36628") + def test_concretization_with_compilers_supporting_target_any(self): + """Tests that a compiler with 'target: any' can satisfy any target, and is a viable + candidate for concretization. + """ + compiler_configuration = [ + { + "compiler": { + "spec": "gcc@12.1.0", + "paths": { + "cc": "/some/path/gcc", + "cxx": "/some/path/g++", + "f77": None, + "fc": None, + }, + "operating_system": "debian6", + "target": "any", + "modules": [], + } + } + ] + + with spack.config.override("compilers", compiler_configuration): + s = spack.spec.Spec("a").concretized() + assert s.satisfies("%gcc@12.1.0") |