Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#59799 closed defect (fixed)

netcdf-fortran: won't build if mpi doesn't match

Reported by: dstrubbe (David Strubbe) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc:
Port: netcdf-fortran

Description

The port failed to upgrade, because I had netcdf installed with +mpich, but netcdf-fortran was just +gcc7. Apparently we now need to enforce compatibility of these variants. I am not sure if this might cause some other problem, so I figured I would file a ticket rather than just commit.

We should enable parallel tests when using MPI, which needed a bit of patching to get to work.

diff --git a/science/netcdf-fortran/Portfile b/science/netcdf-fortran/Portfile
index 5fb29b8f2df..00be09c6cd7 100644
--- a/science/netcdf-fortran/Portfile
+++ b/science/netcdf-fortran/Portfile
@@ -11,6 +11,14 @@ PortGroup                   github 1.0
 # hdf5+cxx (w/o a fortran variant) and netcdf-fortran.
 #mpi.enforce_variant         hdf5
 
+# check to avoid the configure error:
+#        The NetCDF C library is built with parallel I/O feature enabled, but
+#        the Fortran compiler '/opt/local/bin/gfortran-mp-7' supplied in this configure command
+#        does not support MPI-IO. Please use one that does. If parallel I/O
+#        feature is not desired, please use a NetCDF C library with parallel
+#        I/O feature disabled. Abort.
+mpi.enforce_variant         netcdf
+
 github.setup                Unidata netcdf-fortran 4.5.2 v
 revision                    0
 maintainers                 {takeshi @tenomoto} openmaintainer
@@ -66,3 +74,12 @@ if {[variant_isset g95]} {
 
 test.run                    yes
 test.target                 check
+
+if {[mpi_variant_isset]} {
+    configure.args-append      --enable-parallel-tests
+    pre-test {
+        foreach script {nf_test4/run_f77_par_test.sh nf_test4/run_f77_par_test_03.sh nf03_test4/run_f90_par_test.sh examples/F90/run_f90_par_examples.sh} {
+            reinplace -W ${worksrcpath} "s|mpiexec|${prefix}/bin/${mpi.exec}|" ${script}
+        }
+    }
+}

Change History (2)

comment:1 Changed 5 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: assignedclosed

In 11d8aeb203c248352fba810b7a0603d8c225a76c/macports-ports (master):

netcdf-fortran: avoid build error due to mpi mismatch

Closes: #59799

comment:2 Changed 4 years ago by tenomoto (Takeshi Enomoto)

In 11d8aeb203c248352fba810b7a0603d8c225a76c/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

netcdf-fortran: avoid build error due to mpi mismatch

Closes: #59799

Note: See TracTickets for help on using tickets.