From 642c5b876b11f23323338e9025470e6fbdc6e913 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Fri, 16 Dec 2022 14:22:04 -0500 Subject: Compiler detection: avoid false recognition of MSVC (#34574) Interim fix for #34559 Spack's MSVC compiler definition uses ifx as the Fortran compiler. Prior to #33385, the Spack MSVC compiler definition required the executable to be called "ifx.exe"; #33385 replaced this with just "ifx", which inadvertently led to ifx falsely indicating the presence of MSVC on non-Windows systems (which leads to future errors when attempting to query/use those compiler objects). This commit applies a short-term fix by updating MSVC Fortran version detection to always indicate a failure on non-Windows. --- lib/spack/spack/compilers/msvc.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index d7576b78e6..86d51461aa 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -160,6 +160,8 @@ class Msvc(Compiler): def fc_version(cls, fc): # We're using intel for the Fortran compilers, which exist if # ONEAPI_ROOT is a meaningful variable + if not sys.platform == "win32": + return "unknown" fc_ver = cls.default_version(fc) avail_fc_version.add(fc_ver) fc_path[fc_ver] = fc -- cgit v1.2.3-70-g09d2