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 Craig, > I just built and installed version 4.4-beta1 of the Fortran 90 interface for > NetCDF on multiple systems. > > My builds pass all built-in NetCDF tests on all 3 systems (make check | & tee > check.log). > > An example program (pres_temp_4D_wr.f90) provided by NCAR (attached) builds > and runs fine on both my Mac laptop (OS X 10.7) and the SDSC Gordon linux > cluster. > > However, the build fails on our local university linux cluster with errors > like the following: > > ifort ${FFLAGS} -I${NETCDF}/include -L${NETCDF}/lib -lnetcdf -lnetcdff > pres_temp_4D_wr.f90 -o wr.exe I think you need to have -lnetcdf *after* -lnetcdff, because the Fortran library calls functions in the C library. --Russ > /tmp/ifortgqaUzq.o: In function `pres_temp_4d_wr_IP_writenetcdf_': > pres_temp_4D_wr.f90:(.text+0x1292): undefined reference to > `netcdf_mp_nf90_create_' > pres_temp_4D_wr.f90:(.text+0x131a): undefined reference to > `netcdf_mp_nf90_def_dim_' > pres_temp_4D_wr.f90:(.text+0x1352): undefined reference to > `netcdf_mp_nf90_def_dim_' > pres_temp_4D_wr.f90:(.text+0x1387): undefined reference to > `netcdf_mp_nf90_def_dim_' > pres_temp_4D_wr.f90:(.text+0x13bc): undefined reference to > `netcdf_mp_nf90_def_dim_' > pres_temp_4D_wr.f90:(.text+0x13f5): undefined reference to > `netcdf_mp_nf90_def_dim_' > pres_temp_4D_wr.f90:(.text+0x151d): undefined reference to > `netcdf_mp_nf90_def_var_onedim_' > pres_temp_4D_wr.f90:(.text+0x155d): undefined reference to > `netcdf_mp_nf90_def_var_onedim_' > pres_temp_4D_wr.f90:(.text+0x1655): undefined reference to > `netcdf_mp_nf90_def_var_manydims_' > pres_temp_4D_wr.f90:(.text+0x16d1): undefined reference to > `netcdf_mp_nf90_def_var_manydims_' > pres_temp_4D_wr.f90:(.text+0x174d): undefined reference to > `netcdf_mp_nf90_def_var_manydims_' > pres_temp_4D_wr.f90:(.text+0x178c): undefined reference to > `netcdf_mp_nf90_put_att_text_' > pres_temp_4D_wr.f90:(.text+0x17cb): undefined reference to > `netcdf_mp_nf90_put_att_text_' > pres_temp_4D_wr.f90:(.text+0x180a): undefined reference to > `netcdf_mp_nf90_put_att_text_' > pres_temp_4D_wr.f90:(.text+0x1849): undefined reference to > `netcdf_mp_nf90_put_att_text_' > pres_temp_4D_wr.f90:(.text+0x1888): undefined reference to > `netcdf_mp_nf90_put_att_text_' > pres_temp_4D_wr.f90:(.text+0x18fe): undefined reference to > `netcdf_mp_nf90_enddef_' > pres_temp_4D_wr.f90:(.text+0x198a): undefined reference to > `netcdf_mp_nf90_put_var_1d_fourbytereal_' > pres_temp_4D_wr.f90:(.text+0x19cb): undefined reference to > `netcdf_mp_nf90_put_var_1d_fourbytereal_' > pres_temp_4D_wr.f90:(.text+0x1cb3): undefined reference to > `netcdf_mp_nf90_put_var_text_' > pres_temp_4D_wr.f90:(.text+0x1e02): undefined reference to > `netcdf_mp_nf90_put_var_3d_fourbytereal_' > pres_temp_4D_wr.f90:(.text+0x1f47): undefined reference to > `netcdf_mp_nf90_put_var_3d_fourbytereal_' > pres_temp_4D_wr.f90:(.text+0x2011): undefined reference to > `netcdf_mp_nf90_close_' > pres_temp_4D_wr.f90:(.text+0x217c): undefined reference to > `netcdf_mp_nf90_strerror_' > pres_temp_4D_wr.f90:(.text+0x2290): undefined reference to > `netcdf_mp_nf90_strerror_' > pres_temp_4D_wr.f90:(.text+0x23a4): undefined reference to > `netcdf_mp_nf90_strerror_' > pres_temp_4D_wr.f90:(.text+0x24b8): undefined reference to > `netcdf_mp_nf90_strerror_' > pres_temp_4D_wr.f90:(.text+0x25cc): undefined reference to > `netcdf_mp_nf90_strerror_' > /tmp/ifortgqaUzq.o:pres_temp_4D_wr.f90:(.text+0x26e0): more undefined > references to `netcdf_mp_nf90_strerror_' follow > > The objects seem to be in the appropriate NetCDF library: > > nm -A -g $NETCDF/lib/libnetcdff.a | grep netcdf_mp_nf90_create_ > /nethome/cmattock/usr/local/netcdf4/lib/libnetcdff.a:netcdf.o:00000000000002c0 > T netcdf_mp_nf90_create_ > /nethome/cmattock/usr/local/netcdf4/lib/libnetcdff.a:netcdf.o:00000000000000a0 > T netcdf_mp_nf90_create_mp_ > > nm -A -g $NETCDF/lib/libnetcdff.a | grep netcdf_mp_nf90_def_dim_ > /nethome/cmattock/usr/local/netcdf4/lib/libnetcdff.a:netcdf.o:0000000000000340 > T netcdf_mp_nf90_def_dim_ > > etc. > > I can compile the program: > ifort -c ${FFLAGS} -I${NETCDF}/include pres_temp_4D_wr.f90 > > ls -l > -rw-r--r-- 1 cmattock soden 15886 Aug 3 14:02 pres_temp_4D_wr.f90 > -rw-r--r-- 1 cmattock soden 38992 Aug 3 17:49 pres_temp_4D_wr.o > > but I can't seem to link the object to the Fortran libraries. > > What am I doing wrong? Any hints or suggestions? > > Thank you! > Craig > > --------------------------------------------------- > Dr. Craig A. Mattocks > Atmospheric Research Scientist > Meteorology and Physical Oceanography, MSC 339 > Rosenstiel School of Marine and Atmospheric Science > University of Miami > 4600 Rickenbacker Causeway > Miami, FL 33149-1301 > phone: (305) 421-4287 > e-mail: address@hidden > address@hidden > http://www.rsmas.miami.edu/about-rsmas/ > --------------------------------------------------- > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: RSG-712199 Department: Support netCDF Priority: Normal Status: Closed