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

[netCDF #VCJ-482195]: Linking NF_OPEN into fortran?



Hi Robert,

> I tried -lnetcdff -lnetcsf but still nothing found. I also noticed
> that the install does NOT move the netcdff.a file to the --prefix dir!

You would only need
  ... -Lprefix-dir/lib -lnetcdff -lnetcdf
if you configured with either --enable-shared or --enable-separate-fortran.
If you didn't use either of these as an argument to configure, you should be
able to just use -L to tell it where the library is and -lnetcdf to specify
the library.  "make install" would not have moved a libnetcdff.a into the
--prefix directory in this case.

Shared libraries make things more complicated, so if you can get by with
simpler
static libraries, I recommend not using --enable-shared when you build netCDF.

Also you could try running
  ldd progname
on your program named "progname" to see where it is looking for libraries.
If you notice it's looking somewhere other than where you installed netCDF,
perhaps you need to get rid of your LD_LIBRARY_PATH environment variable or
delete older versions of the netCDF shared libraries ending in ".so".

If you have a libnetcdf.a installed where you think it should be and you are
specifying it properly with
   ... -Lprefix-dir/lib -lnetcdf
try seeing what form of "nf_open" name is stored there, using
   nm -g libnetcdf.a | grep nf_open

If that shows the library contains nf_open_ with only one underscore but your
compiler used for linking is looking for nf_open__ with two underscores, then
that is the problem.  You may need to use a different flag to your C compiler
when building to get it to use two trailing underscores in names for the F77
interfaces such as nf_open.  For more on this issue, see the section on Fortran
compilers in the Installation Guide, section 3.8.10 Handling Fortran
Compilers:

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install.html#Platform-Specific-Notes

In case you are using Intel compilers such as ifort, I just noticed a new web
page
on ``Building netCDF with the Intel compilers'' at

http://www.intel.com/support/performancetools/sb/CS-027812.htm

providing configuration and set-up information, and instructions for
building netCDF on Linux and Mac OS. It covers use of Fortran compilers
and C++ compilers.

If this doesn't help, please let us know ...

--Russ




Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: VCJ-482195
Department: Support netCDF
Priority: Normal
Status: Closed