Re: [netcdfgroup] Compiling netCDF in Fortran

Yes it goes into the options line.

The fink version compiles netcdf with an option set that puts the C libraries 
in libnetcdf and the FORTRAN libraries in libnetcdff  (that is not a typo), so 
you need both.  There are two -L's set, since the libraries live in different 
locations.

The other errors have to do with options on how a compiler stores the names of 
functions in libraries, and what you are compiling with does not use the same 
options as what the libraries were compiled with.

I would suggest changing the g77 to gfortran in the make file.  If you still 
get errors, could you give which version of the Mac OS you have, as well as do 
the following in the terminal and give the results:

which gfortran

gfortran --version

fink --version

-Roy







On Jul 29, 2010, at 2:22 PM, Jose Borrero wrote:

> 
> 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.
> 
> 
> 
> 

**********************
"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 



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