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 Sandy, > I am trying to build netcdf version 4.1.1 on computer: > > Model Name: MacBook Pro 17" > Model Identifier: MacBookPro2,1 > Processor Name: Intel Core 2 Duo > Processor Speed: 2.33 GHz > Number Of Processors: 1 > Total Number Of Cores: 2 > L2 Cache (per processor): 4 MB > Memory: 2 GB > Bus Speed: 667 MHz > Boot ROM Version: MBP21.00A5.B08 > SMC Version: 1.14f5 > > running MAC OSX 10.4.11. > > I am using the gfortran compilers and am trying to compile the F90 > interface. The output of running configure and 'make check install' > are attached . . They seem to run without issue. Here is the output > of running nc-config: > > > This netCDF 4.1.1 has been built with the following features: > > --cc -> cc > --cflags -> -I/Users/sandy/netcdf/netcdf-4.1.1/include > --libs -> -L/Users/sandy/netcdf/netcdf-4.1.1/lib -lnetcdf - > lcurl -lssl -lcrypto -lz > > --cxx -> g++ > --has-c++ -> yes > > --fc -> gfortran > --fflags -> -g -O2 -I/Users/sandy/netcdf/netcdf-4.1.1/include > --flibs -> -L/Users/sandy/netcdf/netcdf-4.1.1/lib -lnetcdf - > lcurl -lssl -lcrypto -lz > --has-f77 -> yes > --has-f90 -> yes > > --has-dap -> yes > --has-nc2 -> yes > --has-nc4 -> no > --has-hdf5 -> no > --has-hdf4 -> no > --has-szlib -> no > > --prefix -> /Users/sandy/netcdf/netcdf-4.1.1 > --includedir-> /Users/sandy/netcdf/netcdf-4.1.1/include > --version -> netCDF 4.1.1 > > > The problem is that no libnetcdff.a file is generated in the lib > directory so when I try to compile my program I get: > > /usr/bin/ld: Undefined symbols: > ___netcdf_MOD_nf90_close > ___netcdf_MOD_nf90_open > ___netcdf_MOD_nf90_strerror > > Wazzupp? No libnetcdff.a file is generated becasue you didn't specify wither of the configure options --enable-shared or --enable-separate-fortran (which would be turned on automatically if shared libraries were built). So your build should have put the Fortran API into the libnetcdf.a library that was installed. I just checked this by building from 4.1.1 the way you did, and no libnetcdff.a was installed, just libnetcdf.a and libnetcdf.la, but gfortran still built f90 programs OK: $ FC=gfortran ./configure --disable-netcdf-4 --prefix=/machine/russ/nc411 $ make check install ... test$ cp ../netcdf-4.1.1/examples/F90/simple_xy_wr.f90 . test$ /machine/russ/nc411/bin/nc-config --fflags -g -O2 -I/machine/russ/nc411/include test$ /machine/russ/nc411/bin/nc-config --flibs -L/machine/russ/nc411/lib -lnetcdf -lcurl test$ gfortran -g -O2 -I/machine/russ/nc411/include simple_xy_wr.f90 -o simple_xy_wr -L/machine/russ/nc411/lib -lnetcdf -lcurl test$ ./simple_xy_wr *** SUCCESS writing example file simple_xy.nc! So I can't reproduce the problem you are seeing. Maybe you have a previous installation with older shared libraries, and those are being used instead of the new static library you just installed? I doubt is this is a version issue, but here are the versions of compiler and OS I'm using: test$ gfortran --version GNU Fortran (GCC) 4.2.1 (Apple Inc. build 5659) + GF 4.2.4 test$ cc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) test$ uname -a Darwin mort.unidata.ucar.edu 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: XFB-201563 Department: Support netCDF Priority: Normal Status: Closed