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.
> > I am using a pgf90 in a i686 2.6.8-24.25-smp Linux #1 SMP > to compile netCDF 3.6.2 > > CPPFLAGS="-DNDEBUG -DpgiFortran" > FC=/usr/pgi/linux86/7.0/bin/pgf90 > > from make check > > Making check in F77 > make[2]: Entering directory `/home/garcia/netcdf-3.6.2/examples/F77' > make simple_xy_wr simple_xy_rd sfc_pres_temp_wr sfc_pres_temp_rd > pres_temp_4D_wr pres_temp_4D_rd > make[3]: Entering directory `/home/garcia/netcdf-3.6.2/examples/F77' > make[3]: simple_xy_wr ist bereits aktualisiert. > make[3]: simple_xy_rd ist bereits aktualisiert. > make[3]: sfc_pres_temp_wr ist bereits aktualisiert. > make[3]: sfc_pres_temp_rd ist bereits aktualisiert. > make[3]: pres_temp_4D_wr ist bereits aktualisiert. > make[3]: pres_temp_4D_rd ist bereits aktualisiert. > make[3]: Leaving directory `/home/garcia/netcdf-3.6.2/examples/F77' > make check-TESTS > make[3]: Entering directory `/home/garcia/netcdf-3.6.2/examples/F77' > *** SUCCESS writing example file simple_xy.nc! > PASS: simple_xy_wr > *** SUCCESS reading example file simple_xy.nc! > PASS: simple_xy_rd > *** SUCCESS writing example file sfc_pres_temp.nc! > PASS: sfc_pres_temp_wr > *** SUCCESS reading example file sfc_pres_temp.nc! > PASS: sfc_pres_temp_rd > *** SUCCESS writing example filepres_temp_4D.nc! > PASS: pres_temp_4D_wr > *** SUCCESS reading example file pres_temp_4D.nc! > PASS: pres_temp_4D_rd > > *** Testing that F77 examples produced same files as C examples. > *** checking simple_xy.nc... > *** checking sfc_pres_temp.nc... > *** checking pres_temp_4D.nc... > *** All F77 example comparisons worked! > PASS: do_comps.sh > ================== > All 7 tests passed > ================== > > using > nm -g ../netcdf/lib/libnetcdf.a | grep nf_open > U nf_open_ > 00000560 T nf_open_ > > > But when I am compiling (the libraries and include files are in ../netcdf) > > pgf90 -o emis.exe -I../netcdf/include -L../netcdf/lib -lnetcdf > main-emiss.o ncf_read.o extract.o sum_fields.o data_store.o conversion.o > extract.o(.text+0x5d): In function `extract_': > : undefined reference to `nf_open_' > extract.o(.text+0xa7): In function `extract_': > : undefined reference to `nf_inq_varid_' > extract.o(.text+0x146): In function `extract_': > : undefined reference to `nf_get_vara_real_' > extract.o(.text+0x177): In function `extract_': > : undefined reference to `nf_close_' > extract.o(.text+0x254): In function `handle_err_': > : undefined reference to `nf_strerror_' > > the same happens when i ams using the test cases as: > > pgf90 -L../netcdf/lib -lnetcdf -I../netcdf/include simple_xy_rd.f90 > simple_xy_rd.f90: > simple_xy_rd.o(.text+0xa5): In function `MAIN_': > : undefined reference to `netcdf_nf90_open_' > simple_xy_rd.o(.text+0xe9): In function `MAIN_': > : undefined reference to `netcdf_nf90_inq_varid_' > simple_xy_rd.o(.text+0x153): In function `MAIN_': > : undefined reference to `netcdf_nf90_get_var_2d_fourbyteint_' > simple_xy_rd.o(.text+0x3ab): In function `MAIN_': > : undefined reference to `netcdf_nf90_close_' > simple_xy_rd.o(.text+0x569): In function `simple_xy_rd_check': > : undefined reference to `netcdf_nf90_strerror_' > > nm -g ../netcdf/lib/libnetcdf.a | grep netcdf_nf90_open > 000002b0 T netcdf_nf90_open_ > 00000340 T netcdf_nf90_open_mp_ > > The libraries are there but doesnt link those > > do I miss a flag or something else? > > > Agustin Garcia > -- > Centro de Ciencias de la Atmosfera, UNAM > Ciudad Universitaria, Circuito Exterior s/n, 04510 Mexico DF > tel 52(55) 56 22 4064 Fax 52(55)56 16 0789 > > Fortran is always a problem! However, PGI and netCDF are well tested. See here: http://www.unidata.ucar.edu/software/netcdf/builds/snapshot/ If the examples link, then the library is working. Are you sure it is installed where you think it is? Try doing a "make clean check" in the examples/F77 directory. This will rebuild the Fortran 77 examples and you can copy their command line and see if that works. Did you do a "make install"? Thanks, Ed Ticket Details =================== Ticket ID: QUY-433308 Department: Support netCDF Priority: Normal Status: Open