[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #FTD-335729]: netcdf F90 - trouble linking



> Hi Ed,
>
> Well, I'm glad I'm not the only one scratching my head.  Many thanks for your
help with this.
>
> I did run make check on the netcdf build, and it reported success.
>
> Moving the netCDF library to the end of the list in the linker command gives
the same result:
>
> =====
> /usr/bin/gfortran -g -O2 kinds.o physical_parameters.o eau_params.o
sib_const_module.o sib_io_module.o sib_bc_module.o sibtype.o timetype.o
addinc.o balan.o dtess_eau.o begtem.o cfrax.o clm_combo.o combine_snow.o
compact_snow.o cycalc.o delef.o delhf.o dellwf.o hydro_canopy.o hydro_snow.o
hydro_soil.o qsat_eau.o ess_eau.o netrad.o phosib.o rada2.o rbrd.o respsib.o
rnload.o soilwater.o sortin.o subdivide_snow.o tridiag_solver.o vmfcalz.o
vmfcalzo.o vntlat.o sibslv.o update.o resp_control.o sib.o handle_err.o
init_grid.o init_var.o zenith.o init_sibdrv.o time_init.o time_manager.o
sibdrv_read_single.o sibdrv_read_ecmwf.o sibdrv_read_ncep2.o
sibdrv_read_geos4.o read_ti.o mapper.o calculate_td.o read_ndvi.o previous_bc.o
rtape_sib.o diagnostic_output.o pbpwrite.o qpwrite.o output_control.o
sibdrv_interp.o bc_interp.o SiBDRV.o  -L/usr/global/lapackpp/lib -llapack
-lblas /home3/twh142/netcdf-3.6.2-snapshot2007111702/libsrc/.libs/libnetcdf.a
-o  SiBD3
> handle_err.o(.text+0x7a): In function `handle_err_':
> /home3/twh142/wlef/sib3/handle_err.F90:19: undefined reference to
`nf90_strerror_'
> init_grid.o(.text+0xe35): In function `init_grid_':
> /home3/twh142/wlef/sib3/init_grid.F90:178: undefined reference to
`nf90_open_'
>
> etc. etc.
> =====
>
> The names of the functions may be getting at the root of the problem.  As I
was discussing with Russ, the function names from nm are slightly different
from the function names that the linker complains about.  As quoted above, the
linker complains about "undefined reference to `nf90_strerror_'".  nm shows
different underscoring for that function:
>
> =====
> nm /home3/twh142/netcdf-3.6.2-snapshot2007111702/libsrc/.libs/libnetcdf.a |
grep strerror
> 0000000000000000 T nc_strerror
> U strerror
> U nc_strerror
> U nc_strerror
> 00000000000000c0 T nf_strerror_
> 0000000000000050 T __netcdf__nf90_strerror
> U nf_strerror_
> =====
>
> The only appearance of "nf90_sterror", which is what the linker complains
about, is part of "__netcdf__nf90_strerror" in the nm output.  Is the
"__netcdf__" that is tacked onto the front and the trailing underscore the
problem, maybe?  If so, I am linking with the full path to gfortran
(/usr/bin/gfortran).  This is the same path I supplied for the F90, F77, and FC
environment variables before running configure during the netcdf build, so the
gfortran version should be the same for both.
>
> Thanks!
> Tim

Now that is rather funny. Make sure that you are using the same gfortran that
netCDF was built with. In the netCDF configure output, there is a line that
tells you where it found the fortran compiler (search for "type gfortran" in
the configure output).

Is this the same gfortran you are now trying to use?

Gfortran recently changed how function names are mangled. The change came about
version 4.0 or 4.1. So if you are using two different versions of gfotran, one
to build netCDF, and another to compile your user program, you would see this
problem...

Please let me know if this is the answer.

If not, please send me the complete output of the netCDF configure and make,
and the file config.log, and make sure you do "make distclean" first, so that I
get all the information...

Thanks,

Ed


Ticket Details
===================
Ticket ID: FTD-335729
Department: Support netCDF
Priority: Normal
Status: Open