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.
>To: address@hidden >From: Eirh-Yu Hsie <address@hidden> >Subject: netCDF V3.5.0 >Organization: Aeronomy Laboratory/NOAA/DOC >Keywords: 200203182020.g2IKKna25010 Hi Eirh-Yu, > I am trying to compile a old netcdf program (using Verions 2 fortran > interface) with newer library (Version 3.5.0). It keeps compaining that > the loader can not find the verion 2 interface. But fort-v2compat is in > the library: > > cumulus:[65]% f77 -o netdcfG1.x -L/opt/local/lib -R/opt/local/lib > -lnetcdf netdc > fG1.f > netdcfG1.f: > MAIN: > Undefined first referenced > symbol in file > ncdinq_ netdcfG1.o > ncvid_ netdcfG1.o > ncvinq_ netdcfG1.o > ncopn_ netdcfG1.o > ncclos_ netdcfG1.o > ncinq_ netdcfG1.o > ncvgt_ netdcfG1.o > ld: fatal: Symbol referencing errors. No output written to netdcfG1.x > cumulus:[66]% ar -t /opt/local/lib/libnetcdf.a > attr.o > dim.o > error.o > libvers.o > nc.o > ncio.o > ncx.o > putget.o > string.o > v1hpg.o > v2i.o > var.o > fort-attio.o > fort-control.o > fort-dim.o > fort-genatt.o > fort-geninq.o > fort-genvar.o > fort-lib.o > fort-misc.o > fort-v2compat.o > fort-vario.o > fort-var1io.o > fort-varaio.o > fort-varmio.o > fort-varsio.o > netcdf.o > typeSizes.o > > The machine is a Sun Sparc 3000 running Solaris 7. The netcdf version > is 3.5.0. Maybe the program was compiled with a different compiler than the netCDF-3.5 version of the library you have. A different C or Fortran compiler uses different conventions for calling C functions from Fortran, which is how the netCDF-2 Fortran interface is implemented. Try recompiling the program using the same compilers and flags used to build the 3.5 version of the library. Also if you still have the netCDF source directories where it was built, you can run "make test" in the src/fortran directory to make sure the version 2 compatibility library is tested and works. If you want to see the compiler flags it was built with, use "make clean test" in that directory, assuming you have write permission there. You can also use "nm" to look at the actual names used in the fort-v2compat.o object file, something like: $ nm -A /opt/local/lib/libnetcdf.a | grep ncdinq for example, which should show something like /opt/local/lib/libnetcdf.a[fort-v2compat.o]: [29] | 4496| 72|FUNC |LOCL |0 |2 |c_ncdinq /opt/local/lib/libnetcdf.a[fort-v2compat.o]: [110] | 4568| 236|FUNC |GLOB |0 |2 |ncdinq_ If the name "ncdinq" appears with a different number of underscores before or after the name, that is an indication that a different compiler was used in creating the library. --Russ