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 Dan, > Per request by NCAR, I've been attempting to build NetCDF 4.2 on the Janus > supercomputer (RHEL 5.6, kernel 2.6.18-238.12.1). I had no problems building > the NetCDF 4.2 C libraries, but I can't get the Fortran libraries to install. > Here are the options I've used to build netcdf-fortran-4.2: > > CC=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpicc > FC=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpif90 > F90=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpif90 > F77=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpif90 > CXX=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpic++ > MPICXX=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpic++ > MPICC=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpicc > MPIF77=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpif77 > MPIF90=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin/mpif90 > CPPFLAGS="-DgFortran > -I/curc/tools/x_86_64/rh5/netcdf/4.2/hdf5/1.8.8/openmpi/1.4.5/intel/12.1.4/include" > LDFLAGS=-L/curc/tools/x_86_64/rh5/netcdf/4.2/hdf5/1.8.8/openmpi/1.4.5/intel/12.1.4/lib > LD_LIBRARY_PATH=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/lib:/curc/tools/nonfree/redhat_5_x86_64/intel-12.1.4/composer_xe_2011_sp1.10.319/debugger/lib/intel64:/curc/tools/nonfree/redhat_5_x86_64/intel-12.1.4/composer_xe_2011_sp1.10.319/mkl/lib/intel64:/curc/tools/nonfree/redhat_5_x86_64/intel-12.1.4/composer_xe_2011_sp1.10.319/compiler/lib/intel64:/curc/tools/free/redhat_5_x86_64/sun_jdk-1.6.0_23-x86_64/lib:/curc/tools/free/redhat_5_x86_64/torque-2.5.8/lib > FFLAGS=-I/curc/tools/x_86_64/rh5/netcdf/4.2/hdf5/1.8.8/openmpi/1.4.5/intel/12.1.4/include > > ./configure > --prefix=/curc/tools/x_86_64/rh5/netcdf/4.2/intel/netcdf-4.2_intel-12.1.4_hdf5-1.8.8_openmpi-1.4.5_fortran > -disable-shared > > I can configure and make the Fortran libraries successfully, but the > following error is thrown during "make check:" > > [snip] > > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:115: undefined reference > to `nc_get_vars_int' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function `nf_put_vars_real_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:130: undefined reference > to `nc_put_vars_float' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function `nf_get_vars_real_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:142: undefined reference > to `nc_get_vars_float' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function > `nf_put_vars_double_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:150: undefined reference > to `nc_put_vars_double' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function > `nf_get_vars_double_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:157: undefined reference > to `nc_get_vars_double' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function `nf_put_vars_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:160: undefined reference > to `nc_put_vars' > ../fortran/.libs/libnetcdff.a(fort-varsio.o): In function `nf_get_vars_': > /tmp/netcdf/netcdf-fortran-4.2/fortran/fort-varsio.c:163: undefined reference > to `nc_get_vars' > make[2]: *** [nf_test] Error 1 > make[2]: Leaving directory `/tmp/netcdf/netcdf-fortran-4.2/nf_test' > make[1]: *** [check-am] Error 2 > make[1]: Leaving directory `/tmp/netcdf/netcdf-fortran-4.2/nf_test' > make: *** [check-recursive] Error 1 > > What is causing this issue? I suspect it may be that the fortran/cfortran.h header file, used to handle differences in how C functions are called from Fortran for different compilers, is failing to provide the right macros for the mpif90 compiler you are using. One thing you could try is setting your PATH to include the directory in which the compilers are found, and just setting the environment variables that configure is using to the names of the executables, e.g. PATH=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin:$PATH FC=mpif90 F90=mpif90 F77=mpif90 ... to see if that gets the right definitions of the cfortran.h macros. Alternatively, you could try the new beta release of the separate Fortran package, that makes use of the Fortran-2003 C-interoperability features, assuming your mpif90 compiler supports this. That completely avoids the old cfortran.h macros. Just get this version of the netCDF-Fortran package: ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.4-beta1.tar.gz also available as the beta release from the downloads page: http://www.unidata.ucar.edu/downloads/netcdf/netcdf-fortran/index.jsp In building it, just tell it where to find the installed netCDF-3 libraries, with CPPFLAGS and LDFLAGS, as you did for the netcdf-fortran-4.2 package. Please let us know if that works. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: YWH-955421 Department: Support netCDF Priority: Normal Status: Closed