This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Dennis, > Package Version: netcdf-fortran-4.2 > Operating System: CentOS 5.8 > Hardware: > Description of problem: > > I have a problem getting nf_test in netcdf-fortran-4.2 to compile. > > My environment is: > > NETCDFHOME /usr/local/netcdf-4.2.1.1_intel_12 > CC mpicc > FC mpif90 > F90 mpif90 > F77 mpif90 > CXX mpiCC > CFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel' > CXXFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel' > FFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel' > CPP 'icc -E' > CXXCPP 'icpc -E' > CPPFLAGS '-I/usr/local/netcdf-4.2.1.1_intel_12/include > -I/usr/local/hdf5-1.8.9_intel_12/include -I/usr/local/zlib-1.2.7_intel_12' > LDFLAGS '-L/usr/local/netcdf-4.2.1.1_intel_12/lib > -L/usr/local/hdf5-1.8.9_intel_12/lib > -L/usr/local/zlib-1.2.7_intel_12'http://svn.unidata.ucar.edu/repos/netcdf-fortran/trunk/ > LD_LIBRARY_PATH > /usr/local/netcdf-4.2.1.1_intel_12/lib:/usr/local/hdf5-1.8.9_intel_12/lib:/usr/local/zlib-1.2.7_intel_12:$LD_LIBRARY_PATH > setenv LIBS '-lnetcdf -lhdf5_hl -lhdf5 -lz' > setenv LDLIBS '-lnetcdf -lhdf5_hl -lhdf5 -lz' > > My configure is: > > configure --prefix=/usr/local/netcdf-4.2.1.1_intel_12 --enable-shared > --enable-static --enable-parallel-tests > > 'make' completes with no errors. > > A 'make check' fails at this point: > > ... > libtool: link: mpif90 -I../fortran -I../f90 -O3 -fPIC -xHost -ip -no-prec-div > -static-intel -o .libs/nf_test test_get.o test_put.o nf_error.o nf_test.o > test_read.o test_write.o util.o fortlib.o > -L/usr/local/netcdf-4.2.1.1_intel_12/lib -L/usr/local/hdf5-1.8.9_intel_12/lib > -L/usr/local/zlib-1.2.7_intel_12 ../fortran/.libs/libnetcdff.so > -L/usr/local/zlib-1.2.7/lib > /usr/local/netcdf-4.2.1.1_intel_12/lib/libnetcdf.so > /usr/local/hdf5-1.8.9_intel_12/lib/libhdf5_hl.so > /usr/local/hdf5-1.8.9_intel_12/lib/libhdf5.so -lrt -lm -lz -Wl,-rpath > -Wl,/usr/local/netcdf-4.2.1.1_intel_12/lib -Wl,-rpath > -Wl,/usr/local/hdf5-1.8.9_intel_12/lib > test_get.o: In function `test_nf_get_var1_text_': > test_get.F:(.text+0x31): undefined reference to `nf_open_' > test_get.F:(.text+0x108): undefined reference to `nf_get_var1_text_' > test_get.F:(.text+0x148): undefined reference to `nf_get_var1_text_' > test_get.F:(.text+0x1e0): undefined reference to `nf_get_var1_text_' > test_get.F:(.text+0x2f8): undefined reference to `nf_get_var1_text_' > test_get.F:(.text+0x365): undefined reference to `nf_close_' > ...etc... > > A 'nm fortran/.libs/libnetcdff.a | grep nf_open' shows: > > 0000000000000250 T nf_open__ > 0000000000000130 T nf_open_par__ > U nf_open_ > U nf_open_par_ > > What am I doing wrong? I'm not sure, but have two suggestions to try: 1. Add -DgFortran to your CPPFLAGS and run configure again 2. If that doesn't work, try our current netcdf-fortran test release at http://svn.unidata.ucar.edu/repos/netcdf-fortran/trunk/ which uses the standard F03 C-interoperability mechanisms to call C functions from Fortran, so doesn't need the underbar or double-underbar name mangling stuff currently in cfortran.h that only works for certain C and Fortran compiler combinations. If you try approach 2, you'll have to run autoreconf -i first to generate a configure script, which may entail installing the autoconf package, if you don't already have it. If one of these works, please let us know. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: YTJ-181465 Department: Support netCDF Priority: Normal Status: Closed