Remove runtime errors for Fortran compilers (#49981)
This commit is contained in:
parent
b4646c340c
commit
2cbc21d584
@ -107,19 +107,6 @@ class Adios(AutotoolsPackage):
|
|||||||
sha256="aea47e56013b57c2d5d36e23e0ae6010541c3333a84003784437768c2e350b05",
|
sha256="aea47e56013b57c2d5d36e23e0ae6010541c3333a84003784437768c2e350b05",
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate(self, spec):
|
|
||||||
"""Checks if incompatible variants have been activated at the same time
|
|
||||||
|
|
||||||
Args:
|
|
||||||
spec: spec of the package
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
RuntimeError: in case of inconsistencies
|
|
||||||
"""
|
|
||||||
if "+fortran" in spec and not self.compiler.fc:
|
|
||||||
msg = "cannot build a fortran variant without a fortran compiler"
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def with_or_without_hdf5(self, activated):
|
def with_or_without_hdf5(self, activated):
|
||||||
if activated:
|
if activated:
|
||||||
return f"--with-phdf5={self.spec['hdf5'].prefix}"
|
return f"--with-phdf5={self.spec['hdf5'].prefix}"
|
||||||
@ -133,7 +120,6 @@ def setup_build_environment(self, env):
|
|||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
self.validate(spec)
|
|
||||||
|
|
||||||
extra_args = [
|
extra_args = [
|
||||||
# required, otherwise building its python bindings will fail
|
# required, otherwise building its python bindings will fail
|
||||||
|
@ -48,12 +48,6 @@ class Cmor(AutotoolsPackage):
|
|||||||
depends_on("py-wheel", when="+python", type="build")
|
depends_on("py-wheel", when="+python", type="build")
|
||||||
depends_on("py-numpy", type=("build", "run"), when="+python")
|
depends_on("py-numpy", type=("build", "run"), when="+python")
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def validate(self):
|
|
||||||
if self.spec.satisfies("+fortran") and not self.compiler.fc:
|
|
||||||
msg = "cannot build a fortran variant without a fortran compiler"
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
args = ["--disable-debug"]
|
args = ["--disable-debug"]
|
||||||
|
@ -305,11 +305,6 @@ def libs(self):
|
|||||||
msg.format("shared" if shared else "static", self.spec.name, self.spec.prefix)
|
msg.format("shared" if shared else "static", self.spec.name, self.spec.prefix)
|
||||||
)
|
)
|
||||||
|
|
||||||
@run_before("cmake")
|
|
||||||
def check_fortran(self):
|
|
||||||
if "+fortran" in self.spec and self.compiler.fc is None:
|
|
||||||
raise InstallError("Fortran interface requires a Fortran compiler!")
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
jp2k = self.spec.variants["jp2k"].value
|
jp2k = self.spec.variants["jp2k"].value
|
||||||
|
|
||||||
|
@ -42,14 +42,6 @@ class Flibcpp(CMakePackage):
|
|||||||
depends_on("swig@4.0.2-fortran", type="build", when="+swig")
|
depends_on("swig@4.0.2-fortran", type="build", when="+swig")
|
||||||
depends_on("py-sphinx", type="build", when="+doc")
|
depends_on("py-sphinx", type="build", when="+doc")
|
||||||
|
|
||||||
@run_before("cmake")
|
|
||||||
def die_without_fortran(self):
|
|
||||||
# Until we can pass compiler requirements through virtual
|
|
||||||
# dependencies, explicitly check for Fortran compiler instead of
|
|
||||||
# waiting for configure error.
|
|
||||||
if (self.compiler.f77 is None) or (self.compiler.fc is None):
|
|
||||||
raise InstallError("Flibcpp requires a Fortran compiler")
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
from_variant = self.define_from_variant
|
from_variant = self.define_from_variant
|
||||||
fstd_key = (
|
fstd_key = (
|
||||||
|
@ -69,14 +69,6 @@ class Fortrilinos(CMakePackage):
|
|||||||
"trilinos+amesos2+anasazi+belos+kokkos+ifpack2+muelu+nox+tpetra" "+stratimikos", when="+hl"
|
"trilinos+amesos2+anasazi+belos+kokkos+ifpack2+muelu+nox+tpetra" "+stratimikos", when="+hl"
|
||||||
)
|
)
|
||||||
|
|
||||||
@run_before("cmake")
|
|
||||||
def die_without_fortran(self):
|
|
||||||
# Until we can pass variants such as +fortran through virtual
|
|
||||||
# dependencies, require Fortran compiler to
|
|
||||||
# avoid delayed build errors in dependents.
|
|
||||||
if (self.compiler.f77 is None) or (self.compiler.fc is None):
|
|
||||||
raise InstallError("ForTrilinos requires a Fortran compiler")
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
return [
|
return [
|
||||||
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
|
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
|
||||||
|
@ -38,13 +38,6 @@ class H5hut(AutotoolsPackage):
|
|||||||
# install: .libs/libH5hut.a: No such file or directory
|
# install: .libs/libH5hut.a: No such file or directory
|
||||||
parallel = False
|
parallel = False
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def validate(self):
|
|
||||||
"""Checks if Fortran compiler is available."""
|
|
||||||
|
|
||||||
if self.spec.satisfies("+fortran") and not self.compiler.fc:
|
|
||||||
raise RuntimeError("Cannot build Fortran variant without a Fortran compiler.")
|
|
||||||
|
|
||||||
def flag_handler(self, name, flags):
|
def flag_handler(self, name, flags):
|
||||||
build_system_flags = []
|
build_system_flags = []
|
||||||
if (
|
if (
|
||||||
|
@ -516,12 +516,6 @@ def setup_run_environment(self, env):
|
|||||||
# LD_LIBRARY_PATH.
|
# LD_LIBRARY_PATH.
|
||||||
env.append_path("LD_LIBRARY_PATH", self.prefix.lib)
|
env.append_path("LD_LIBRARY_PATH", self.prefix.lib)
|
||||||
|
|
||||||
@run_before("cmake")
|
|
||||||
def fortran_check(self):
|
|
||||||
if self.spec.satisfies("+fortran") and not self.compiler.fc:
|
|
||||||
msg = "cannot build a Fortran variant without a Fortran compiler"
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
|
||||||
|
@ -68,11 +68,6 @@ def is_64bit(self):
|
|||||||
def build_command_line(self):
|
def build_command_line(self):
|
||||||
args = ["-noLogo"]
|
args = ["-noLogo"]
|
||||||
ifort_bin = self.pkg.compiler.fc
|
ifort_bin = self.pkg.compiler.fc
|
||||||
if not ifort_bin:
|
|
||||||
raise InstallError(
|
|
||||||
"Cannot install MSMPI without fortran"
|
|
||||||
"please select a compiler with fortran support."
|
|
||||||
)
|
|
||||||
args.append("/p:IFORT_BIN=%s" % os.path.dirname(ifort_bin))
|
args.append("/p:IFORT_BIN=%s" % os.path.dirname(ifort_bin))
|
||||||
args.append("/p:VCToolsVersion=%s" % self.pkg.compiler.msvc_version)
|
args.append("/p:VCToolsVersion=%s" % self.pkg.compiler.msvc_version)
|
||||||
args.append("/p:WindowsTargetPlatformVersion=%s" % str(self.pkg.spec["wdk"].version))
|
args.append("/p:WindowsTargetPlatformVersion=%s" % str(self.pkg.spec["wdk"].version))
|
||||||
|
@ -276,14 +276,6 @@ def setup_dependent_package(self, module, dependent_spec):
|
|||||||
os.path.join(self.prefix.lib, f"libmpi.{dso_suffix}"),
|
os.path.join(self.prefix.lib, f"libmpi.{dso_suffix}"),
|
||||||
]
|
]
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def die_without_fortran(self):
|
|
||||||
# Until we can pass variants such as +fortran through virtual
|
|
||||||
# dependencies depends_on('mpi'), require Fortran compiler to
|
|
||||||
# avoid delayed build errors in dependents.
|
|
||||||
if (self.compiler.f77 is None) or (self.compiler.fc is None):
|
|
||||||
raise InstallError("Mvapich requires both C and Fortran compilers!")
|
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
args = [
|
args = [
|
||||||
|
@ -161,9 +161,6 @@ def patch(self):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
if (self.compiler.fc is None) or (self.compiler.cc is None):
|
|
||||||
raise InstallError("NCL package requires both " "C and Fortran compilers.")
|
|
||||||
|
|
||||||
self.prepare_site_config()
|
self.prepare_site_config()
|
||||||
self.prepare_install_config()
|
self.prepare_install_config()
|
||||||
self.prepare_src_tree()
|
self.prepare_src_tree()
|
||||||
|
@ -48,12 +48,6 @@ class Nek5000(Package):
|
|||||||
|
|
||||||
patch("add_fjfortran.patch", when="%fj")
|
patch("add_fjfortran.patch", when="%fj")
|
||||||
|
|
||||||
@run_before("install")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.f77:
|
|
||||||
msg = "Cannot build Nek5000 without a Fortran 77 compiler."
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
def check_install(self):
|
def check_install(self):
|
||||||
with working_dir("short_tests/eddy"):
|
with working_dir("short_tests/eddy"):
|
||||||
|
@ -35,12 +35,6 @@ class Nekbone(Package):
|
|||||||
|
|
||||||
depends_on("mpi", when="+mpi")
|
depends_on("mpi", when="+mpi")
|
||||||
|
|
||||||
@run_before("install")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.fc:
|
|
||||||
msg = "Nekbone can not be built without a Fortran compiler."
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
mkdir(prefix.bin)
|
mkdir(prefix.bin)
|
||||||
|
|
||||||
|
@ -34,12 +34,6 @@ class Nekcem(Package):
|
|||||||
depends_on("blas")
|
depends_on("blas")
|
||||||
depends_on("lapack")
|
depends_on("lapack")
|
||||||
|
|
||||||
@run_before("install")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.fc:
|
|
||||||
msg = "NekCEM can not be built without a Fortran compiler."
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
def check_install(self):
|
def check_install(self):
|
||||||
nekcem_test = join_path(self.prefix.bin, "NekCEM", "tests", "2dboxpec")
|
nekcem_test = join_path(self.prefix.bin, "NekCEM", "tests", "2dboxpec")
|
||||||
|
@ -68,12 +68,6 @@ class Nektools(Package):
|
|||||||
depends_on("libxt", when="+postnek")
|
depends_on("libxt", when="+postnek")
|
||||||
depends_on("visit", when="+visit")
|
depends_on("visit", when="+visit")
|
||||||
|
|
||||||
@run_before("install")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.f77:
|
|
||||||
msg = "Cannot build Nek5000 without a Fortran 77 compiler."
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
tools_dir = "tools"
|
tools_dir = "tools"
|
||||||
bin_dir = "bin"
|
bin_dir = "bin"
|
||||||
|
@ -297,20 +297,6 @@ def parallel(self):
|
|||||||
# unclear whether setting `-j N` externally was supported before 0.3
|
# unclear whether setting `-j N` externally was supported before 0.3
|
||||||
return self.spec.version >= Version("0.3.0")
|
return self.spec.version >= Version("0.3.0")
|
||||||
|
|
||||||
@run_before("edit")
|
|
||||||
def check_compilers(self):
|
|
||||||
# As of 06/2016 there is no mechanism to specify that packages which
|
|
||||||
# depends on Blas/Lapack need C or/and Fortran symbols. For now
|
|
||||||
# require both.
|
|
||||||
# As of 08/2022 (0.3.21), we can build purely with a C compiler using
|
|
||||||
# a f2c translated LAPACK version
|
|
||||||
# https://github.com/xianyi/OpenBLAS/releases/tag/v0.3.21
|
|
||||||
if self.compiler.fc is None and "~fortran" not in self.spec:
|
|
||||||
raise InstallError(
|
|
||||||
self.compiler.cc
|
|
||||||
+ " has no Fortran compiler added in spack. Add it or use openblas~fortran!"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def headers(self):
|
def headers(self):
|
||||||
# The only public headers for cblas and lapacke in
|
# The only public headers for cblas and lapacke in
|
||||||
|
@ -277,8 +277,6 @@ def configure(self, spec, prefix):
|
|||||||
f.write("process_lib_dir = {0}\n".format(self.spec.prefix.proclib))
|
f.write("process_lib_dir = {0}\n".format(self.spec.prefix.proclib))
|
||||||
f.write("cc = {0}\n".format(env["SPACK_CC"]))
|
f.write("cc = {0}\n".format(env["SPACK_CC"]))
|
||||||
f.write("cxx = {0}\n".format(env["SPACK_CXX"]))
|
f.write("cxx = {0}\n".format(env["SPACK_CXX"]))
|
||||||
if not self.compiler.fc:
|
|
||||||
raise InstallError(f"{self.spec.compiler} has no Fortran compiler in spack!")
|
|
||||||
f.write("fortran_compiler = {0}\n".format(env["SPACK_FC"]))
|
f.write("fortran_compiler = {0}\n".format(env["SPACK_FC"]))
|
||||||
if self.spec.satisfies("@1.3.1") and not is_intel:
|
if self.spec.satisfies("@1.3.1") and not is_intel:
|
||||||
f.write("gfortran_f_flags = -ffree-line-length-none\n")
|
f.write("gfortran_f_flags = -ffree-line-length-none\n")
|
||||||
|
@ -1013,14 +1013,6 @@ def with_or_without_tm(self, activated):
|
|||||||
return "--without-tm"
|
return "--without-tm"
|
||||||
return f"--with-tm={self.spec['pbs'].prefix}"
|
return f"--with-tm={self.spec['pbs'].prefix}"
|
||||||
|
|
||||||
@run_before("autoreconf")
|
|
||||||
def die_without_fortran(self):
|
|
||||||
# Until we can pass variants such as +fortran through virtual
|
|
||||||
# dependencies depends_on('mpi'), require Fortran compiler to
|
|
||||||
# avoid delayed build errors in dependents.
|
|
||||||
if (self.compiler.f77 is None) and (self.compiler.fc is None):
|
|
||||||
raise InstallError("OpenMPI requires both C and Fortran compilers!")
|
|
||||||
|
|
||||||
@when("@main")
|
@when("@main")
|
||||||
def autoreconf(self, spec, prefix):
|
def autoreconf(self, spec, prefix):
|
||||||
perl = which("perl")
|
perl = which("perl")
|
||||||
|
@ -177,12 +177,6 @@ def configure_args(self):
|
|||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.fc:
|
|
||||||
msg = "PAPI requires a Fortran compiler to build"
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
@run_before("configure")
|
@run_before("configure")
|
||||||
def component_configure(self):
|
def component_configure(self):
|
||||||
configure_script = Executable("./configure")
|
configure_script = Executable("./configure")
|
||||||
|
@ -52,12 +52,6 @@ class Petaca(CMakePackage):
|
|||||||
|
|
||||||
variant("std_name", default=False, description="enables std_mod_proc_name with intel")
|
variant("std_name", default=False, description="enables std_mod_proc_name with intel")
|
||||||
|
|
||||||
# copied from openmpi/package.py to ensure fortran support
|
|
||||||
@run_before("cmake")
|
|
||||||
def die_without_fortran(self):
|
|
||||||
if (self.compiler.f77 is None) or (self.compiler.fc is None):
|
|
||||||
raise InstallError("petaca requires both C and Fortran compilers!")
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
return [
|
return [
|
||||||
self.define("ENABLE_TESTS", self.run_tests),
|
self.define("ENABLE_TESTS", self.run_tests),
|
||||||
|
@ -314,12 +314,6 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
|||||||
filter_compiler_wrappers("petscvariables", "reconfigure*.py", relative_root="lib/petsc/conf")
|
filter_compiler_wrappers("petscvariables", "reconfigure*.py", relative_root="lib/petsc/conf")
|
||||||
filter_compiler_wrappers("petsc.pc", "PETSc.pc", relative_root="lib/pkgconfig")
|
filter_compiler_wrappers("petsc.pc", "PETSc.pc", relative_root="lib/pkgconfig")
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def check_fortran_compiler(self):
|
|
||||||
# Raise error if +fortran and there isn't a fortran compiler!
|
|
||||||
if "+fortran" in self.spec and self.compiler.fc is None:
|
|
||||||
raise InstallError("+fortran requires a fortran compiler!")
|
|
||||||
|
|
||||||
# temporary workaround Clang 8.1.0 with XCode 8.3 on macOS, see
|
# temporary workaround Clang 8.1.0 with XCode 8.3 on macOS, see
|
||||||
# https://bitbucket.org/petsc/petsc/commits/4f290403fdd060d09d5cb07345cbfd52670e3cbc
|
# https://bitbucket.org/petsc/petsc/commits/4f290403fdd060d09d5cb07345cbfd52670e3cbc
|
||||||
# the patch is an adaptation of the original commit to 3.7.5
|
# the patch is an adaptation of the original commit to 3.7.5
|
||||||
|
@ -32,15 +32,6 @@ class Pnmpi(CMakePackage):
|
|||||||
depends_on("doxygen")
|
depends_on("doxygen")
|
||||||
depends_on("mpi")
|
depends_on("mpi")
|
||||||
|
|
||||||
@run_before("cmake")
|
|
||||||
def check_fortran(self):
|
|
||||||
is_no_fortran_compiler = not self.compiler.f77 and not self.compiler.fc
|
|
||||||
if self.spec.satisfies("+fortran"):
|
|
||||||
if is_no_fortran_compiler:
|
|
||||||
raise InstallError(
|
|
||||||
"pnmpi+fortran requires Fortran compiler " "but no Fortran compiler found!"
|
|
||||||
)
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
args = []
|
args = []
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
@ -230,11 +230,6 @@ def archive_files(self):
|
|||||||
|
|
||||||
@run_before("install")
|
@run_before("install")
|
||||||
def set_fortran_compiler(self):
|
def set_fortran_compiler(self):
|
||||||
if self.compiler.f77 is None or self.compiler.fc is None:
|
|
||||||
raise InstallError(
|
|
||||||
"py-scipy requires Fortran compilers. Configure Fortran compiler to proceed."
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.spec.satisfies("%fj"):
|
if self.spec.satisfies("%fj"):
|
||||||
with open("setup.cfg", "w") as f:
|
with open("setup.cfg", "w") as f:
|
||||||
f.write("[config_fc]\n")
|
f.write("[config_fc]\n")
|
||||||
|
@ -18,8 +18,6 @@ class Spherepack(Package):
|
|||||||
depends_on("gmake", type="build")
|
depends_on("gmake", type="build")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
if self.compiler.fc is None:
|
|
||||||
raise InstallError("SPHEREPACK requires a Fortran 90 compiler")
|
|
||||||
make("MAKE=make", "F90=f90 -O2 -fallow-argument-mismatch", "AR=ar", "libspherepack")
|
make("MAKE=make", "F90=f90 -O2 -fallow-argument-mismatch", "AR=ar", "libspherepack")
|
||||||
make("MAKE=make", "F90=f90 -O2 -fallow-argument-mismatch", "AR=ar", "testspherepack")
|
make("MAKE=make", "F90=f90 -O2 -fallow-argument-mismatch", "AR=ar", "testspherepack")
|
||||||
install_tree("lib", prefix.lib)
|
install_tree("lib", prefix.lib)
|
||||||
|
@ -424,12 +424,6 @@ def do_configure_fixup(self):
|
|||||||
)
|
)
|
||||||
config.filter("^CC_TOOLS(.*?)=([^#\n\r]*)(.*)$", r"CC_TOOLS\1=\2 -fpermissive \3")
|
config.filter("^CC_TOOLS(.*?)=([^#\n\r]*)(.*)$", r"CC_TOOLS\1=\2 -fpermissive \3")
|
||||||
|
|
||||||
@run_before("configure")
|
|
||||||
def fortran_check(self):
|
|
||||||
if not self.compiler.fc:
|
|
||||||
msg = "cannot build WRF without a Fortran compiler"
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
def configure(self, spec, prefix):
|
def configure(self, spec, prefix):
|
||||||
# Remove broken default options...
|
# Remove broken default options...
|
||||||
self.do_configure_fixup()
|
self.do_configure_fixup()
|
||||||
|
Loading…
Reference in New Issue
Block a user