MSVC: Broken ifx needs new $TMP (#42155)

Certain versions of ifx (the majority of those available) have an issue
where they are not compatible with TMP directories with dot chars
This precludes their use with CMake.
Remap TMP to point to the stage directory rather than whatever the TMP
default is
This commit is contained in:
John W. Parent 2024-01-30 13:18:54 -05:00 committed by GitHub
parent a20c0de6d8
commit 749301d133
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@
import re import re
import subprocess import subprocess
import sys import sys
import tempfile
from typing import Dict, List, Set from typing import Dict, List, Set
import spack.compiler import spack.compiler
@ -15,7 +16,7 @@
import spack.util.executable import spack.util.executable
from spack.compiler import Compiler from spack.compiler import Compiler
from spack.error import SpackError from spack.error import SpackError
from spack.version import Version from spack.version import Version, VersionRange
avail_fc_version: Set[str] = set() avail_fc_version: Set[str] = set()
fc_path: Dict[str, str] = dict() fc_path: Dict[str, str] = dict()
@ -292,6 +293,15 @@ def setup_custom_environment(self, pkg, env):
else: else:
env.set_path(env_var, int_env[env_var].split(os.pathsep)) env.set_path(env_var, int_env[env_var].split(os.pathsep))
# certain versions of ifx (2021.3.0:2023.1.0) do not play well with env:TMP
# that has a "." character in the path
# Work around by pointing tmp to the stage for the duration of the build
if self.fc and Version(self.fc_version(self.fc)).satisfies(
VersionRange("2021.3.0", "2023.1.0")
):
new_tmp = tempfile.mkdtemp(dir=pkg.stage.path)
env.set("TMP", new_tmp)
env.set("CC", self.cc) env.set("CC", self.cc)
env.set("CXX", self.cxx) env.set("CXX", self.cxx)
env.set("FC", self.fc) env.set("FC", self.fc)