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 Wendi, I just verified that the netcdf 3.6.2 source distribution works fine without --enable-shared on an up-to-date G4 Mac, so I think static linking still works. Here's some details: $ sw_vers ProductName: Mac OS X ProductVersion: 10.4.10 BuildVersion: 8R218 $ gfortran --version GNU Fortran 95 (GCC) 4.3.0 20061223 (experimental) $ ./configure --prefix=/Users/russ/netcdf/releases ... $ make check ... [Some warning messages, but all tests succeeded] $ make install [Installs libraries and executables under /Users/russ/netcdf/releases/lib/, bin/, include/, etc.] To link a Fortran program to the newly installed library, this seems to work: $ gfortran -I/Users/russ/netcdf/releases/include -c simple_xy_wr.f90 which creates simple_xy_wr.o, then to link to the library, I had to give the absolute pathname of the netCCDF library. $ gfortran -o simple_xy_wr simple_xy_wr.o /Users/russ/netcdf/releases/lib/libnetcdf.a I think the following more conventional way of linking is supposed to work, and I'm not sure why it doesn't, but it seems like a gfortran or MacOS X issue, not a netCDF issue: $ gfortran -o simple_xy_wr simple_xy_wr.o -L/Users/russ/netcdf/releases/lib -lnetcdf /usr/bin/ld: Undefined symbols: ___netcdf__nf90_close ___netcdf__nf90_create ___netcdf__nf90_def_dim ___netcdf__nf90_def_var_manydims ___netcdf__nf90_enddef ___netcdf__nf90_put_var_2d_fourbyteint ___netcdf__nf90_strerror collect2: ld returned 1 exit status So if you can link the first way, by naming the static library, it should work for you. I'll try to find out whether there is a workaround that makes the second method work as it is supposed to. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: GAW-821062 Department: Support netCDF Priority: Normal Status: Closed