summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Cohn <robert.s.cohn@intel.com>2023-11-27 13:57:10 -0500
committerGitHub <noreply@github.com>2023-11-27 11:57:10 -0700
commitfbec91e491776717c72a61f2791473e9c19e6af6 (patch)
tree3c8b38d59f6ce164a92746ba50bf4d7f79cad290 /lib
parent3d744e7c951eab4fa70b95c15c5cabc969dd47b3 (diff)
downloadspack-fbec91e491776717c72a61f2791473e9c19e6af6.tar.gz
spack-fbec91e491776717c72a61f2791473e9c19e6af6.tar.bz2
spack-fbec91e491776717c72a61f2791473e9c19e6af6.tar.xz
spack-fbec91e491776717c72a61f2791473e9c19e6af6.zip
handle use of an unconfigured compiler (#41213)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py12
-rw-r--r--lib/spack/spack/compilers/__init__.py8
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 36574259d0..20d8e75f9b 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -324,19 +324,29 @@ def set_compiler_environment_variables(pkg, env):
# ttyout, ttyerr, etc.
link_dir = spack.paths.build_env_path
- # Set SPACK compiler variables so that our wrapper knows what to call
+ # Set SPACK compiler variables so that our wrapper knows what to
+ # call. If there is no compiler configured then use a default
+ # wrapper which will emit an error if it is used.
if compiler.cc:
env.set("SPACK_CC", compiler.cc)
env.set("CC", os.path.join(link_dir, compiler.link_paths["cc"]))
+ else:
+ env.set("CC", os.path.join(link_dir, "cc"))
if compiler.cxx:
env.set("SPACK_CXX", compiler.cxx)
env.set("CXX", os.path.join(link_dir, compiler.link_paths["cxx"]))
+ else:
+ env.set("CC", os.path.join(link_dir, "c++"))
if compiler.f77:
env.set("SPACK_F77", compiler.f77)
env.set("F77", os.path.join(link_dir, compiler.link_paths["f77"]))
+ else:
+ env.set("F77", os.path.join(link_dir, "f77"))
if compiler.fc:
env.set("SPACK_FC", compiler.fc)
env.set("FC", os.path.join(link_dir, compiler.link_paths["fc"]))
+ else:
+ env.set("FC", os.path.join(link_dir, "fc"))
# Set SPACK compiler rpath flags so that our wrapper knows what to use
env.set("SPACK_CC_RPATH_ARG", compiler.cc_rpath_arg)
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 6366fc321b..be9edeecb4 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -154,6 +154,14 @@ def add_compilers_to_config(compilers, scope=None, init_config=True):
"""
compiler_config = get_compiler_config(scope, init_config)
for compiler in compilers:
+ if not compiler.cc:
+ tty.debug(f"{compiler.spec} does not have a C compiler")
+ if not compiler.cxx:
+ tty.debug(f"{compiler.spec} does not have a C++ compiler")
+ if not compiler.f77:
+ tty.debug(f"{compiler.spec} does not have a Fortran77 compiler")
+ if not compiler.fc:
+ tty.debug(f"{compiler.spec} does not have a Fortran compiler")
compiler_config.append(_to_dict(compiler))
spack.config.set("compilers", compiler_config, scope=scope)