diff --git a/var/spack/repos/builtin/packages/mapl/package.py b/var/spack/repos/builtin/packages/mapl/package.py index 61ca8b94f18..e53b5cd0812 100644 --- a/var/spack/repos/builtin/packages/mapl/package.py +++ b/var/spack/repos/builtin/packages/mapl/package.py @@ -252,9 +252,11 @@ class Mapl(CMakePackage): conflicts("%gcc@13:", when="@:2.44") # MAPL can use ifx only from MAPL 2.51 onwards and only supports - # ifx 2025.0 and newer due to bugs in ifx - conflicts("%oneapi@:2024") - conflicts("%oneapi", when="@:2.50") + # ifx 2025.0 and newer due to bugs in ifx. + conflicts("%oneapi@2025:", when="@:2.50") + # NOTE there is a further check on oneapi in the cmake_args below + # that is hard to conflict since we don't know the fortran compiler + # at this point variant("flap", default=False, description="Build with FLAP support", when="@:2.39") variant("pflogger", default=True, description="Build with pFlogger support") @@ -388,6 +390,22 @@ def cmake_args(self): if fflags: args.append(self.define("CMAKE_Fortran_FLAGS", " ".join(fflags))) + # If oneapi@:2024 is used and it gets past the conflict above, we might be + # using ifx or ifort. If we are using ifx and the MAPL version is 2.50 or older + # we need to raise an error + + if self.spec.satisfies("@:2.50 %oneapi@:2024"): + # We now need to get which Fortran compiler is used here but there + # isn't an easy way like: + # if self.spec["fortran"].name == "ifx": + # yet (see https://github.com/spack/spack/pull/45189) + # So we need to parse the output of $FC --version + output = spack.compiler.get_compiler_version_output( + self.compiler.fc, "-diag-disable=10448 --version", ignore_errors=True + ) + if "ifx" in output: + raise InstallError("MAPL versions 2.50 and older do not support ifx") + # Scripts often need to know the MPI stack used to setup the environment. # Normally, we can autodetect this, but building with Spack does not # seem to work. We need to pass in the MPI stack used to CMake