diff options
author | Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> | 2024-01-29 12:53:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 12:53:13 +0100 |
commit | 594069961ab357926abaa76df82e77de51284d31 (patch) | |
tree | 13061ba7adb9f96ed7708629bd7e9bad2c444c9c | |
parent | 9eb445f0a2ae07e3bfa20e8215f462f36583ad60 (diff) | |
download | spack-594069961ab357926abaa76df82e77de51284d31.tar.gz spack-594069961ab357926abaa76df82e77de51284d31.tar.bz2 spack-594069961ab357926abaa76df82e77de51284d31.tar.xz spack-594069961ab357926abaa76df82e77de51284d31.zip |
netcdf-fortran: fix static linking in some cases (#35466)
* netcdf-fortran: enable building against static netcdf-c
* netcdf-fortran: strip the output of nc-config
-rw-r--r-- | var/spack/repos/builtin/packages/netcdf-fortran/package.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/netcdf-fortran/package.py b/var/spack/repos/builtin/packages/netcdf-fortran/package.py index c30bf0b684..dbd4fd8e08 100644 --- a/var/spack/repos/builtin/packages/netcdf-fortran/package.py +++ b/var/spack/repos/builtin/packages/netcdf-fortran/package.py @@ -40,6 +40,12 @@ class NetcdfFortran(AutotoolsPackage): depends_on("netcdf-c@4.7.4:", when="@4.5.3:") # nc_def_var_szip required depends_on("doxygen", when="+doc", type="build") + # We need to use MPI wrappers when building against static MPI-enabled NetCDF and/or HDF5: + with when("^netcdf-c~shared"): + depends_on("mpi", when="^netcdf-c+mpi") + depends_on("mpi", when="^netcdf-c+parallel-netcdf") + depends_on("mpi", when="^hdf5+mpi~shared") + # Enable 'make check' for NAG, which is too strict. patch("nag_testing.patch", when="@4.4.5%nag") @@ -129,6 +135,12 @@ class NetcdfFortran(AutotoolsPackage): # configuration failure, we set the following cache variable: config_args.append("ac_cv_func_MPI_File_open=yes") + if "~shared" in netcdf_c_spec: + nc_config = which("nc-config") + config_args.append("LIBS={0}".format(nc_config("--libs", output=str).strip())) + if any(s in netcdf_c_spec for s in ["+mpi", "+parallel-netcdf", "^hdf5+mpi~shared"]): + config_args.append("CC=%s" % self.spec["mpi"].mpicc) + return config_args def check(self): |