Re: [netcdfgroup] Compiling netCDF in Fortran

On 29/07/2010, at 4:20 PM, Roy Mendelssohn wrote:

> If you did a recent install using fink, it has the option set to separately 
> compile the fortran library from the C library, 

yes, a recent install, i have no idea what options were set.  it took a very 
long time to go through the whole process though..

> so your compile line would need something like
> -L/sw/lib -lnetcdf  -L/sw/lib/netcdf-gfortran/lib  -lnetcdff

(your revised line above)

hmm, compile line?  is that the OPT line?

my original:
OPT        =  -O -I/sw/lib/netcdf-gfortran/include 
-L/sw/lib/netcdf-gfortran/lib -lnetcdf

changed to: ?

OPT = -O -I/sw/lib/netcdf-gfortran/include -L/sw/lib -lnetcdf  
-L/sw/lib/netcdf-gfortran/lib  -lnetcdff

Tried that line above, and got a string of errors like the ones before I had 
netCDF install at all.  I think there is a syntax issue?  Things like:

"_nf_sync_", referenced from:
      _MAIN__ in ccxMDf6y.o
      _MAIN__ in ccxMDf6y.o
      _MAIN__ in ccxMDf6y.o

why 2 -L flags?  why 2 f's at the end of -lnetcdff ?

i'll assume '-lnetcdff' is a typo and should be '-lnetcdf'

then i modified to:
OPT = -O -I/sw/lib/netcdf-gfortran/include -lnetcdf  
-L/sw/lib/netcdf-gfortran/lib  -lnetcdf

because I think you are trying to tell me that the '-lnetcdf' has to be invoked 
after each section on the OPT line?

This time it was a bit closer and the result was back where we started:

=====================================
ld: library not found for -lnetcdf
collect2: ld returned 1 exit status
make: *** [most3_x] Error 1
=====================================

using both g77 and gfortran

hmmmm?

> However, if it is from a recent install, I wouldn't be surprised if g77 fails 
> and you would need to use gfortran instead.  

also tried swapping gfortran for g77 in the compiler call line, same results..

> But give it a try.






  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: