[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #FTD-335729]: netcdf F90 - trouble linking
- Subject: [netCDF #FTD-335729]: netcdf F90 - trouble linking
- Date: Thu, 01 Nov 2007 14:47:29 -0600
Tim,
It looks like you now have "-L/home3/twh142/netcdf_install/lib
-lnetcdf" both before and after the .o files such as init_grid.o that
call netCDF functions. I think that should work, but it doesn't in
some cases, and the man page documentation for the "ld" command on my
system says:
If any argument is a library, ld by default searches the library
exactly once at the point the library is encountered on the
argument list.
so the same may be true for gfortran. If that's the case (I can't
test it right now), then you could solve the problem by just removing
the first occurrence of the library reference.
However, it's also possible that your library was built with compiler
flags to indicate a different convention for C function names called
from Fortran. You could determing this by using the "nm" utility, for
example:
nm /home3/twh142/netcdf_install/lib/libnetcdf.a | grep nf_open
and see if the resulting name for the function appears with one or two
trailing underscores. If it has two trailing underscores, then the
library and your application were built inconsistently, since your
application is expecting "nf_open_" but the library is providing
"nf_open__". If this is the case, maybe the library was built without
CPPFLAGS set to -DgFortran or some similar problem that the configure
script should have handled.
Another idea to see what should work, in case you still have the
netCDF source directories lying around, is to invoke "make clean
check" in the f90 subdirectory and see how the library is linked in
the resulting compilation and testing, then follow that pattern.
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: FTD-335729
Department: Support netCDF
Priority: Normal
Status: Closed