Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRF v4.0.1 configuration warning about NETCDF #794

Closed
zhihua-zheng opened this issue Feb 26, 2019 · 19 comments · May be fixed by #1269
Closed

WRF v4.0.1 configuration warning about NETCDF #794

zhihua-zheng opened this issue Feb 26, 2019 · 19 comments · May be fixed by #1269

Comments

@zhihua-zheng
Copy link

I have netcdf-c and netcdf-fortran built with nc4 support, but in different directories. With my variable NETCDF was initially set as the path to netcdf-fortran, the configuration of WRF returned a warning message:

NETCDF4 IO features are requested, but this installation of NetCDF
  /opt/netcdf_fortran/4_4_4/intel
DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
   bash/ksh : export NETCDF_classic=1
      echo  csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!!

What I did to resolve this is to make links for netcdf-c and netcdf-fortran, then put them together according to the /lib, /include, /bin structure, and update the variable NETCDF as the path to the new directory.

@weiwangncar
Copy link
Collaborator

@zhihua-zheng Try to set environment variable NETCDF_classic as suggested by the message before you run configure again. In the future, this should be posted to WRF Forum at http://forum.mmm.ucar.edu. Thanks.

@davegill
Copy link
Contributor

@weiwangncar
Wei,
There are some utilities that require WRF to be built with netcdf4. We used to have some build logic to look for the netcdf and netcdff libs. We might need to consider how to handle netcdf installations that have separated C and Fortran directories.

@davegill davegill reopened this Feb 26, 2019
@mgduda
Copy link
Collaborator

mgduda commented Feb 27, 2019

I've also run into problems when the netCDF-4 library is build with support for parallel I/O via HDF5. If we were to significantly overhaul the logic in the configure script for detecting netCDF libraries, we could also consider the potential need to add -lhdf5_hl -lhdf5 -lz.

It might also be worth trying to leverage the output of nc-config --flibs (although this is broken at the moment, as it doesn't report a dependency on the parallel-netCDF library even when netCDF was build with support for pnetcdf).

@JiaweiZhuang
Copy link

@agumartina
Copy link

I had the same problem, with WRF master branch.
Checked the nc4_test.log and saw many libs errors with HDF5 and PNETCDF, so I checked in configure that $(USENETCDF) was assigned only -lnetcdf flag, so i chaged that variable to USENETCDF="-lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl -lmpi -lpnetcdf" and it worked :)

@milancurcic
Copy link
Contributor

Just chiming in as I ran into this issue this morning with WRF-4.1.1. netcdf-c and netcdf-fortran by default install libraries to lib64/ rather than lib/ (this is on some kind of OpenSUSE I believe). Having NetCDF libs in lib64/ triggers the warning regarding NetCDF4 fetures, despite nc-config assuring otherwise. Linking lib64/ to lib/ makes the warning go away.

A pedantic nit-pick: If the NetCDF4 warning doesn't allow the configure to complete (i.e. "configure.wrf has been removed"), it should be called an error.

@lgeorget
Copy link

We had the same issue on a Debian install because we wanted to use the libnetcdf-dev package from the package manager. The problem is that the installer puts the libnetcdf.so library in /usr/lib/x86_64-linux-gnu/ instead of /usr/lib so the USENETCDF variable is not populated properly. We were able to get the configuration to finish correctly by replacing $(USENETCDF) in the Makefile by the output of pkg-config --libs netcdf.

@razib911
Copy link

razib911 commented May 4, 2020

NETCDF4 IO features are requested, but this installation of NetCDF
/home/razib/Build_WRF/LIBRARIES/netcdf
DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
bash/ksh : export NETCDF_classic=1
echo csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!

I am very new to WRF and Ubuntu.
I am trying to install WRFV4.2, using Ubuntu 18LTS, got stuck here while ./configure on WRFv4.2.

I tried to understand the replies but failed. Can anybody tell me how to solve this with an example (command lines)?

@davegill
Copy link
Contributor

davegill commented May 4, 2020

@razib911
First, welcome to WRF.

Second, please take a look at the WRF forum web page: forum.mmm.ucar.edu. That site is specifically set up for user questions. The github site is more for source code bugs.

Third, repost this question on the WRF Forum.

Fourth, did you perhaps try to set the environment variables as suggested? Do not answer here, but include all of this information in the post to the forum. This allows others with a similar problem to search to see the solution.

@opoplawski
Copy link

I would also very much appreciate WRF not assuming that libraries are in a sub-directory of a NETCDFPATH (or HDF5PATH or whatever) called "lib". We need to be able to specify the library directory directly. OpenHPC for example uses the following environment variables:

setenv          NETCDF_DIR        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3
setenv          NETCDF_BIN        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/bin
setenv          NETCDF_LIB        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/lib
setenv          NETCDF_INC        /opt/ohpc/pub/libs/intel/openmpi4/netcdf/4.7.3/include
setenv          NETCDF_FORTRAN_DIR        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2
setenv          NETCDF_FORTRAN_BIN        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/bin
setenv          NETCDF_FORTRAN_LIB        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/lib
setenv          NETCDF_FORTRAN_INC        /opt/ohpc/pub/libs/intel/openmpi4/netcdf-fortran/4.5.2/include

I would suggest using those variable names for looking for items.

@davegill
Copy link
Contributor

davegill commented Jun 9, 2020

@opoplawski
Orion,
A number of users have mentioned issues similar to this. Would you be interested in working on the pull request?

@davegill
Copy link
Contributor

davegill commented Jun 9, 2020

@razib911
Have you taken a look at https://github.com/davegill/wrf-coop/blob/master/README_tutorial.md
For small desktop systems, docker may be a reasonable choice.

@opoplawski
Copy link

@opoplawski
Orion,
A number of users have mentioned issues similar to this. Would you be interested in working on the pull request?

Possibly - I'll see if I can scrape together some time.

@davegill
Copy link
Contributor

@opoplawski
This will be a modification to "develop". Take a look at:
https://github.com/wrf-model/WRF/wiki/Workflow-for-WRF-Code-Modification

Where there are differences with the bug fix and the new feature (develop branch), use the develop branch options.

@irowebbn
Copy link
Contributor

From what I can observe, the specific thing causing the problem is lines 178-203 of the configure script. If the $NETCDF environment variable is pointing to the NetCDF-Fortran folder, it links to the fortran libraries, if it points to the NetCDF-C folder, it links to those libraries. However, WRF needs both, and since NetCDF 4.2, the C and Fortran libraries are distributed separately. The netcdf.inc file is only in the Fortran distribution, so if you link to the C libraries, later the config script complains (lines 637-643). If you link to the Fortran libraries, a bunch of utilities can't get build because they need the C libraries. Somehow, we need to change the section below so the user can set both $NETCDF and $NETCDFF so they are not mutually exclusive.

USENETCDFF=""
USENETCDF=""
if [ -n "$NETCDF" ] ; then
  echo "Will use NETCDF in dir: $NETCDF"
# Oh UNIDATA, why make it so hard ...
  if [ -f "$NETCDF/lib/libnetcdff.a" -o -f "$NETCDF/lib/libnetcdff.so" -o -f "$NETCDF/lib/libnetcdff.dll.a" ] ; then
    USENETCDFF="-lnetcdff"
  else
    USENETCDFF=" "
  fi
  if [ -f "$NETCDF/lib/libnetcdf.a" -o -f "$NETCDF/lib/libnetcdf.so" -o -f "$NETCDF/lib/libnetcdf.dll.a" ] ; then
    USENETCDF="-lnetcdf"
  else
    USENETCDF=" "
  fi
  export USENETCDF=$USENETCDF
  export USENETCDFF=$USENETCDFF
else
  echo ' '
  echo '*****************************************************************************'
  echo 'No environment variable NETCDF set.'
  echo 'Stopping'
  echo '*****************************************************************************'
  echo ' '
  exit 6
fi

@zemboy
Copy link

zemboy commented Mar 16, 2023

I need help. This error message appears when installing WRF_4.1 in my ubunu 22.04.
************************** W A R N I N G ************************************
NETCDF4 IO features are requested, but this installation of NetCDF
/usr
DOES NOT support these IO features.

Please make sure NETCDF version is 4.1.3 or later and was built with
--enable-netcdf4

OR set NETCDF_classic variable
bash/ksh : export NETCDF_classic=1
echo csh : setenv NETCDF_classic 1

Then re-run this configure script

!!! configure.wrf has been REMOVED !!!


@razib911
Copy link

razib911 commented Mar 16, 2023 via email

@zemboy
Copy link

zemboy commented Mar 16, 2023

Hello

Thank you very much for your help.
In which directory should I place myself to execute the code: export NETCDF_classic=1?

@weiwangncar
Copy link
Collaborator

@zemboy It should be in your working terminal. This message and further discussion should be posted in Forum: https://forum.mmm.ucar.edu/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.