diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2024-11-11 23:12:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 14:12:43 -0800 |
commit | 4691301eba3747e1e488034f114cf06946420da4 (patch) | |
tree | dcfd77327aa95bc2912fd28c2c70f551f832d11c /lib | |
parent | a55073e7b09df4a6b2f53844fe470125a1ca76ba (diff) | |
download | spack-4691301eba3747e1e488034f114cf06946420da4.tar.gz spack-4691301eba3747e1e488034f114cf06946420da4.tar.bz2 spack-4691301eba3747e1e488034f114cf06946420da4.tar.xz spack-4691301eba3747e1e488034f114cf06946420da4.zip |
Compiler.default_libc: early exit on darwin/win (#47554)
* Compiler.default_libc: early exit on darwin/win
* use .cc when testing c++ compiler if c compiler is missing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/compiler.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 46382a3d98..e16e4a2725 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -428,6 +428,11 @@ class Compiler: @property def default_libc(self) -> Optional["spack.spec.Spec"]: """Determine libc targeted by the compiler from link line""" + # technically this should be testing the target platform of the compiler, but we don't have + # that, so stick to host platform for now. + if sys.platform in ("darwin", "win32"): + return None + dynamic_linker = self.default_dynamic_linker if not dynamic_linker: @@ -449,14 +454,20 @@ class Compiler: return self.cache.get(self).c_compiler_output def _compile_dummy_c_source(self) -> Optional[str]: - cc = self.cc if self.cc else self.cxx + if self.cc: + cc = self.cc + ext = "c" + else: + cc = self.cxx + ext = "cc" + if not cc or not self.verbose_flag: return None try: tmpdir = tempfile.mkdtemp(prefix="spack-implicit-link-info") fout = os.path.join(tmpdir, "output") - fin = os.path.join(tmpdir, "main.c") + fin = os.path.join(tmpdir, f"main.{ext}") with open(fin, "w") as csource: csource.write( |