summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-05-21 14:09:29 +0200
committerGitHub <noreply@github.com>2024-05-21 14:09:29 +0200
commit8020a111df142696721bdd2ea64a4e61e548ad4a (patch)
tree86bc1fe0a07e1213247d71e01cd6b0b2acf1d9b6 /lib
parent86fb547f7cb562f82c3071d77b28e548fe94898d (diff)
downloadspack-8020a111df142696721bdd2ea64a4e61e548ad4a.tar.gz
spack-8020a111df142696721bdd2ea64a4e61e548ad4a.tar.bz2
spack-8020a111df142696721bdd2ea64a4e61e548ad4a.tar.xz
spack-8020a111df142696721bdd2ea64a4e61e548ad4a.zip
Demote a warning to debug message, if C compiler is not there (#44182)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py11
-rw-r--r--lib/spack/spack/test/conftest.py8
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 46e892a835..0083dbc070 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -314,6 +314,10 @@ def using_libc_compatibility() -> bool:
return spack.platforms.host().name == "linux"
+def c_compiler_runs(compiler: spack.compiler.Compiler) -> bool:
+ return compiler.compiler_verbose_output is not None
+
+
def extend_flag_list(flag_list, new_flags):
"""Extend a list of flags, preserving order and precedence.
@@ -2975,6 +2979,13 @@ class CompilerParser:
def __init__(self, configuration) -> None:
self.compilers: Set[KnownCompiler] = set()
for c in all_compilers_in_config(configuration):
+ if using_libc_compatibility() and not c_compiler_runs(c):
+ tty.debug(
+ f"the C compiler {c.cc} does not exist, or does not run correctly."
+ f" The compiler {c.spec} will not be used during concretization."
+ )
+ continue
+
if using_libc_compatibility() and not c.default_libc:
warnings.warn(
f"cannot detect libc from {c.spec}. The compiler will not be used "
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 29c10fb2e3..99eac4004f 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -2053,3 +2053,11 @@ def _true(x):
@pytest.fixture()
def do_not_check_runtimes_on_reuse(monkeypatch):
monkeypatch.setattr(spack.solver.asp, "_has_runtime_dependencies", _true)
+
+
+@pytest.fixture(autouse=True, scope="session")
+def _c_compiler_always_exists():
+ fn = spack.solver.asp.c_compiler_runs
+ spack.solver.asp.c_compiler_runs = _true
+ yield
+ spack.solver.asp.c_compiler_runs = fn