--with-netcdf-c++=no and --without-netcdf-c++ do not work

Issue #150 resolved
Former user created an issue

config/netcdf.m4 has bugs it in that prevent --with-netcdf-c++=no from working. If --with-netcdf-c++=no is given then it resets it to blank and looks for it in the default system locations.

Thus if the user provides a netcdf directory and uses --with-netcdf-c++=no configure can find an outdated netcdf c++ library and link against it.

The following fix may resolve the problem

diff --git a/config/netcdf.m4 b/config/netcdf.m4
index 1d1da85c6..acb2193d0 100644
--- a/config/netcdf.m4
+++ b/config/netcdf.m4
@@ -160,10 +160,11 @@ if (test "x" != "x$NETCDF_DIR" && test "xno" != "x$NETCDF_DIR"); then
     AC_MSG_RESULT([no])
     # Reset the directory since we do not want to configure NetCDF C++
     NETCDFCXX_DIR=""
+    enablenetcdf_cxx="no"
   fi


-  if (test "x$enablenetcdf" != "xno"); then
+  if (test "x$enablenetcdf_cxx" != "xno"); then
     # check for C++ header files
     if (test "x$NETCDFCXX_DIR" != "x"); then # User specified explicitly a NetCDF C++ installation path
       LDFLAGS="-L$NETCDFCXX_DIR/lib $LDFLAGS"

Comments (4)

  1. Vijay M

    Well, we had support for NetCDF-C++ interface due to a requirement from TempestRemap, which is one of our optional downstream dependency. But the C++ API is broken and AFAIK, discontinued now and so we removed core support in MOAB. I think these are left over configuration that should not exist. I will fix it.

    Is there a reason you need C++ interface to NetCDF directly ?

  2. Vijay M

    Which version of MOAB are you using ? Couple of comments.

    1. In the newer versions of MOAB, NetCDF-C++ library requirement is not required as our downstream package TempestRemap distributes the needed interface directly instead of user installing it
    2. --with-netcdf-c++ is not a valid option in any version. May have been --with-netcdf-cxx which needs to be supplied in addition to --with-netcdf. However, as I mentioned above, the newer MOAB releases only require the NetCDF-C interface that is supplied ONLY with --with-netcdf=$PATHoption
    3. The newer netcdf.m4 files do not have references to NETCDFCXX_DIR variables

    Unless you need other clarifications, I may close this issue.

  3. Vijay M

    Please confirm if you can update your configuration. Your options are wrong. Please use the latest release of MOAB as NetCDF-C++ is no longer needed even with all of our TPL dependencies.

    If I do not hear back, I will consider this issue closed.

  4. Log in to comment