The same command in my shell work fine with the Fortran code.
Due to the way the Makefiles are written, the actual failing command is not printed out.
I was able to somewhat recreate the error by forcibly installing the netCDF libraries in such a way to result in that symbol being missing. This was done by compiling two netCDF C libraries, one with HDF5 and another without, and then building netCDF Fortran against the HDF5-enabled netCDF C but installing it to the non-HDF5 location. This however, does not, nor should it, pass configuration as it fails on the
nc4_test
portion of configuration (my output from
nc4_test.log
below):
Code:
if [ -z "0" ] || [ 0 -eq 0 ] ; then \
( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; gcc -o nc4_test.exe nc4_test.c -I/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//include -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib -lnetcdf -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib -lnetcdff -L/home/aislas/wrf-model/forum_help/tmp_test_forum/forum_libs//lib -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/simple//lib -L/home/aislas/wrf-model/forum_help/tmp_test_forum/forum_libs//grib2/lib -lnetcdf -lnetcdf -lm ; cd .. ) ; \
else \
( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; mpicc -cc=gcc -o nc4_test.exe nc4_test.c -I/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//include -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib -lnetcdf -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib -lnetcdff -L/home/aislas/wrf-model/forum_help/tmp_test_forum/forum_libs//lib -L/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/simple//lib -L/home/aislas/wrf-model/forum_help/tmp_test_forum/forum_libs//grib2/lib -lnetcdf -lnetcdf -lm ; cd .. ) ; \
fi
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib/libnetcdff.so: undefined reference to `nc_get_chunk_cache_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib/libnetcdff.so: undefined reference to `nc_set_var_chunk_cache_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib/libnetcdff.so: undefined reference to `nc_def_var_chunking_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5/lib/libnetcdff.so: undefined reference to `nc_set_chunk_cache_ints'
collect2: error: ld returned 1 exit status
Note, that it is using the shared library libnetcdff.so, which causes symbol checking to be done. If we remove the .so and force usage of the .a archive no undefined symbol checking will be done for this archive, and since the nc4_test is a C file test, as long as the libnetcdf.* works it will pass. Using the same malformed install method I described above, if I force the usage of the libnetcdff.a archive, configuration passes thinking using these two libraries (libnetcdff.a and libnetcdf.* which were not compiled together) can be used together. I end up with a configure.wrf very similar to
@giovdav with regards to NETCDF* variables.
When continuing with this configuration the first error I get is :
Code:
ar: creating ../main/libwrflib.a
ranlib ../main/libwrflib.a
make[2]: Leaving directory '/home/aislas/wrf-model/wrf/frame'
make[2]: Entering directory '/home/aislas/wrf-model/wrf/external/io_netcdf'
x=`echo "time gfortran -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch -fallow-invalid-boz " | awk '{print $1}'` ; export x ; \
if [ $x = "gfortran" ] ; then \
echo removing external declaration of iargc for gfortran ; \
/lib/cpp -P -nostdinc -P -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT -I/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
else \
/lib/cpp -P -nostdinc -P -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT -I/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
fi
time gfortran -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch -fallow-invalid-boz -c -I/home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//include -I../ioapi_share diffwrf.f
0.11user 0.02system 0:00.14elapsed 98%CPU (0avgtext+0avgdata 39136maxresident)k
0inputs+336outputs (0major+5172minor)pagefaults 0swaps
diffwrf io_netcdf is being built now.
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//lib/libnetcdff.a(nf_nc4.o): in function `nf_def_var_chunking_':
nf_nc4.f90:(.text+0x5d4a): undefined reference to `nc_def_var_chunking_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//lib/libnetcdff.a(nf_nc4.o): in function `nf_set_chunk_cache_':
nf_nc4.f90:(.text+0x6b28): undefined reference to `nc_set_chunk_cache_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//lib/libnetcdff.a(nf_nc4.o): in function `nf_get_chunk_cache_':
nf_nc4.f90:(.text+0x6b61): undefined reference to `nc_get_chunk_cache_ints'
/usr/bin/ld: /home/aislas/wrf-model/forum_help/tmp_test_forum/netcdf-c-4.7.2/no_hdf5//lib/libnetcdff.a(nf_nc4.o): in function `nf_set_var_chunk_cache_':
nf_nc4.f90:(.text+0x6bf5): undefined reference to `nc_set_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
real 0m0.115s
user 0m0.089s
sys 0m0.025s
make[2]: [makefile:45: diffwrf] Error 1 (ignored)
This doesn't include the
nc_inq_var_chunking_ints
and I'm not entirely sure why. This post (
GCC version for WRF 4.4) also seems to further confirm that to get into this state, netCDF install must be done wrong. I likewise couldn't find a way to force the installs into a bad state with just (compile netCDF) => (compile netCDF Fortran) with any combination of flags. All the built-in checks catch this before continuing compilation. I tentatively suspect one or more extra netCDF installs were in the environment when that netCDF Fortran libnetcdff.a was built & installed resulting in the usage of a non-compatible netCDF C and Fortran libraries.
As this is using v4.6.0+, you could try using the CMake build. I suspect it will fail as well, which would be good info. It doesn't necessarily mean it isn't a WRF build issue, but the two build systems are very different in resolving dependencies within the same environment suggesting there might instead be a problem with the environment. If it does work, well then the make system might actually be the root cause of this issue.
Another piece of information that would be useful to fully diagnosis this would be to get the output of :
Code:
<netcdf path>/bin/nc-config --all
<netcdf path>/bin/nf-config --all
nm -C <netcdf path>/lib/libnetcdf.<so or a, whichever is in there> | grep nc_get_chunk
nm -C <netcdf path>/lib/libnetcdff.a | grep nf_get_chunk