Classic Intel compilers do not support gcc-toolchain (#33281)

* Classic Intel compilers do not support gcc-toolchain

This fix removes `--gcc-toolchain=` from the ~.fcg` files for the classic Intel
compilers. AFAIK this option is only supported for Clang based compilers.

This lead to an issue when installing cmake. Reproducer:
```
spack install cmake@3.24.2%intel@2021.7.0~doc+ncurses+ownlibs~qt
build_type=Release arch=linux-amzn2-skylake_avx512
```

Tagging maintainer @rscohn2

* Add `-gcc-name` for icc

.. and `-gxx-name` for icpc.

AFAIK this is used for modern C++ support, so we can ignore `ifort`.

Co-authored-by: Stephen Sachs <stesachs@amazon.com>
This commit is contained in:
Stephen Sachs 2022-10-17 18:46:11 +02:00 committed by GitHub
parent e7b14dd491
commit 2e55812417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,7 +131,7 @@ class IntelOneapiCompilers(IntelOneApiPackage):
placement="fortran-installer",
when="@{0}".format(v["version"]),
expand=False,
**v["ftn"]
**v["ftn"],
)
@property
@ -206,21 +206,32 @@ def extend_config_flags(self):
if self.spec.version < Version("2022.1.0"):
flags_list.append("-Wno-unused-command-line-argument")
def write_cfg(cmp_list, flags_list):
flags = " ".join(flags_list)
for cmp in cmp_list:
cfg_file = self.component_prefix.linux.bin.join(cmp + ".cfg")
with open(cfg_file, "w") as f:
f.write(flags)
set_install_permissions(cfg_file)
# Make sure that icc gets the right GCC C+ support
write_cfg(
[
join_path("intel64", "icc"),
],
flags_list + ["-gcc-name={}".format(self.compiler.cc)],
)
write_cfg(
[
join_path("intel64", "icpc"),
],
flags_list + ["-gxx-name={}".format(self.compiler.cxx)],
)
# Make sure that underlying clang gets the right GCC toolchain by default
flags_list.append("--gcc-toolchain={}".format(self.compiler.prefix))
flags = " ".join(flags_list)
for cmp in [
"icx",
"icpx",
"ifx",
join_path("intel64", "icc"),
join_path("intel64", "icpc"),
join_path("intel64", "ifort"),
]:
cfg_file = self.component_prefix.linux.bin.join(cmp + ".cfg")
with open(cfg_file, "w") as f:
f.write(flags)
set_install_permissions(cfg_file)
write_cfg(
["icx", "icpx", "ifx"],
flags_list + ["--gcc-toolchain={}".format(self.compiler.prefix)],
)
def _ld_library_path(self):
# Returns an iterable of directories that might contain shared runtime libraries