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.
Dan, > > Is there actually a netCDF library in that directory, with a name like > > libnetcdf.a? If not, it looks like there's a problem with the PATH you > > used ... > > The contents of the directory are: > libnetcdf.a libnetcdf.la pkgconfig > > > Also, I see you've explicitly turned off shared libraries with the > > "--disable-shared" configure option. Have you tried building with shared > > libraries? > > I've tried that, but "make" fails with a "no such file or directory" error. > I can't remember the file or directory in question, but it is the same error > that NetCDF 4.1.3 throws when I try to build it with shared libraries. Well, evidently the mpif90 Fortran compiler can't link with the libnetcdf.a library. Some other things to try are - Make sure the libnetcdf.a library is 64-bit, assuming that's what your Fortran compiler expects to link with. You can do that with the "file" command to see what kind of object libnetcdf.a is. - Look at how pkgconfig in that directory wants you to link use that library. For example, if that directory is <DIR>, try invoking export PKG_CONFIG_PATH=<DIR> pkg-config --libs --cflags netcdf to see if you need some flag you're not using. - Look at config.log to see the actual source for the program with a call to nc_open, to see how mpif90 is being called to compile and lik with it. There may be an error message in config.log providing more information than that nc_open can't be found. If you can play with mpif90 flags to get that example program linking, it will be easier to see what's needed to get the netcdf-fortran-4.2 build to work. Sorry, that's all I can think of at this point. If you want to extract the config.log output relevant to not finding nc_open, I can see if there's anything obvious that jumps out at me. Here's what is in config.log for finding a library containing nc_open: configure:19683: checking for library containing nc_open configure:19714: gcc -o conftest -g -O2 -I/usr/local/include conftest.c >&5 /tmp/ccivm8m4.o: In function `main': /home/russ/nf/trunk/conftest.c:46: undefined reference to `nc_open' collect2: ld returned 1 exit status configure:19714: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "netCDF-Fortran" | #define PACKAGE_TARNAME "netcdf-fortran" | #define PACKAGE_VERSION "4.2" | #define PACKAGE_STRING "netCDF-Fortran 4.2" | #define PACKAGE_BUGREPORT "address@hidden" | #define PACKAGE_URL "" | #define PACKAGE "netcdf-fortran" | #define VERSION "4.2" | #define TEMP_LARGE "." | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR ".libs/" | #define pgiFortran 1 | #define NF_INT1_T byte | #define NF_INT2_T integer*2 | #define NF_INT1_IS_C_SIGNED_CHAR 1 | #define NF_INT2_IS_C_SHORT 1 | #define NF_INT_IS_C_INT 1 | #define NF_REAL_IS_C_FLOAT 1 | #define NF_DOUBLEPRECISION_IS_C_DOUBLE 1 | #define NCBYTE_T byte | #define NCSHORT_T integer*2 | #define HAVE_NETCDF_H 1 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char nc_open (); | int | main () | { | return nc_open (); | ; | return 0; | } configure:19714: gcc -o conftest -g -O2 -I/usr/local/include conftest.c -lnetcdf >&5 configure:19714: $? = 0 configure:19731: result: -lnetcdf Note that it first reports it's not found, but then succeeds at linking, using "-lnetcdf". --Russ > -----Original Message----- > From: Unidata netCDF Support [mailto:address@hidden] > Sent: Friday, June 29, 2012 11:31 AM > To: Daniel Milroy > Cc: address@hidden > Subject: [netCDF #YWH-955421]: Error during "make check," NetCDF 4.2 Fortran > libs, Janus supercomputer > > Dan, > > > The logs for "configure," "make" and "make check" are attached. > > In your configure output, the following lines means the header file for the > netCDF C library is found, but not the library: > > > checking for netcdf.h... yes > > checking for library containing nc_open... no checking for > > nc_def_opaque... no checking for nccreate... no > > The location of the netCDF library should have been specified with the > LDFLAGS environment variable, which I see you've set as > > > LDFLAGS=-L/curc/tools/x_86_64/rh5/netcdf/4.2/hdf5/1.8.8/openmpi/1.4.5/ > > intel/12.1.4/lib > > Is there actually a netCDF library in that directory, with a name like > libnetcdf.a? If not, it looks like there's a problem with the PATH you used > ... > > Also, I see you've explicitly turned off shared libraries with the > "--disable-shared" > configure option. Have you tried building with shared libraries? > > --Russ > > > -----Original Message----- > > From: Unidata netCDF Support [mailto:address@hidden] > > Sent: Wednesday, June 27, 2012 2:33 PM > > To: Daniel Milroy > > Cc: address@hidden > > Subject: [netCDF #YWH-955421]: Error during "make check," NetCDF 4.2 > > Fortran libs, Janus supercomputer > > > > Dan, > > > > > I forgot to mention before that I had set PATH to include > > > /curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin, so in > > > effect I've already tried that suggestion. I downloaded and built > > > netcdf-fortran-4.4-beta1.tar.gz using options identical to my previous > > > attempt with NetCDF 4.2. Unfortunately, "make check" fails with exactly > > > the same error. > > > > OK, please send us the complete output of configure, make, and make check, > > from the build with netcdf-fortran-4.2. > > > > We might be able to diagnose the problem from that. > > > > --Russ > > > > > -----Original Message----- > > > From: Unidata netCDF Support > > > [mailto:address@hidden] > > > Sent: Wednesday, June 27, 2012 1:24 PM > > > To: Daniel Milroy > > > Cc: address@hidden > > > Subject: [netCDF #YWH-955421]: Error during "make check," NetCDF 4.2 > > > Fortran libs, Janus supercomputer > > > > > > 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 > > > > /m > > > > pi > > > > cc > > > > FC=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bin > > > > /m > > > > pi > > > > f90 > > > > F90=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bi > > > > n/ > > > > mp > > > > if90 > > > > F77=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bi > > > > n/ > > > > mp > > > > if90 > > > > CXX=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/bi > > > > n/ > > > > mp > > > > ic++ > > > > MPICXX=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4 > > > > /b > > > > in > > > > /mpic++ > > > > MPICC=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4/ > > > > bi > > > > n/ > > > > mpicc > > > > MPIF77=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4 > > > > /b > > > > in > > > > /mpif77 > > > > MPIF90=/curc/tools/free/redhat_5_x86_64/openmpi-1.4.5_intel-12.1.4 > > > > /b > > > > in > > > > /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_int > > > > el > > > > -1 > > > > 2.1.4/lib:/curc/tools/nonfree/redhat_5_x86_64/intel-12.1.4/compose > > > > r_ > > > > xe > > > > _2011_sp1.10.319/debugger/lib/intel64:/curc/tools/nonfree/redhat_5 > > > > _x > > > > 86 > > > > _64/intel-12.1.4/composer_xe_2011_sp1.10.319/mkl/lib/intel64:/curc > > > > /t > > > > oo > > > > ls/nonfree/redhat_5_x86_64/intel-12.1.4/composer_xe_2011_sp1.10.31 > > > > 9/ > > > > co > > > > mpiler/lib/intel64:/curc/tools/free/redhat_5_x86_64/sun_jdk-1.6.0_ > > > > 23 -x 86_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 > > > > /i > > > > ntel/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.g > > > z > > > > > > also available as the beta release from the downloads page: > > > > > > http://www.unidata.ucar.edu/downloads/netcdf/netcdf-fortran/index.js > > > p > > > > > > 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 > > > > > > > > > > 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 > > > > > 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 > > 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