netcdf-gfortran
By smg58 at Fri, May 30 2008 12:44pm |
I installed the latest version of gcc using fink, along with the netcdf-gfortran libraries. But I can't figure out how to run the compiler in a way that makes it recognize the netcdf libraries.
If I try to compile without any links, I get the following message:
Undefined symbols:
"_nf_open_", referenced from:
_MAIN__ in ccl8lNrA.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
If I try compiling with a link, I get this:
ld: library not found for -llibnetcdff.a
collect2: ld returned 1 exit status
Is there something really obvious that I'm missing?
Thanks,
Scott



netcdf-gfortran
Hi Scott:
You don't provide much information, such as what your compile line looked like, but a first guess is that because fink supports several netcdfs, you may not be getting the libraries from the correct place. Make certain you have
-L/sw/lib/netcdf-gfortran/lib -lnetcdff
in your compile, as well as the usual link to libnetcdf.a
-Roy M.
Thanks
Thanks, your suggestion got the program to compile correctly. But when I execute the program I get the following error message:
dyld: Symbol not found: _ncopts
Referenced from: /sw/lib/netcdf-gfortran/lib/libnetcdff.4.dylib
Expected in: dynamic lookup
What does that mean?
re: thanks
PS the compile line that worked is:
/sw/bin/gfortran swsinq.f -L/sw/lib/netcdf-gfortran/lib -lnetcdff
netcdf-gfortran
Hi:
An option in the netcdf configure, that fink seems to be using, is to build a separate C and Fortran library. SO you need to link in both. order may matter, and I can't remember which needs to come first, but you need something like:
-L/sw/lib -lnetcdf -L/sw/lib/netcdf-gfortran -lnetcdff
-Roy
but now...
The code compiled, but I'm getting a Bus error.
there was a glitch in the
there was a glitch in the nf_open statement I was using. That took care of the Bus error.