If you did a recent install using fink, it has the option set to separately
compile the fortran library from the C library, so your compile line would need
something like
-L/sw/lib -lnetcdf -L/sw/lib/netcdf-gfortran/ -lnetcdff
However, if it is from a recent install, I wouldn't be surprised if g77 fails
and you would need to use gfortran instead. But give it a try.
-Roy
On Jul 29, 2010, at 1:13 PM, Jose Borrero wrote:
>
> Hello everyone,
>
> I am sure this an incredibly basic question, but maybe someone can tell me
> what i am doing wrong. I am pretty hopeless in this regard.
>
> I have a FORTRAN code that writes data out to netCDF files. It is old, but
> it works...
>
> The code compiles using a makefile that calls various netCDF libraries.
>
> I am using the g77 compiler that i installed via fink
>
> the makefile looks like this:
>
> =================================
> F77 = g77
> OBJ = most3_x
> SRC = most3_nc_x.f offtime.f timestep.f swlon.f swlat.f swrun03.f
> surf_read.f surf_run.f rgrd1.f rgrd2.f
> OPT = -O -I/sw/lib/netcdf-gfortran/include
> -L/sw/lib/netcdf-gfortran/include -lnetcdf
>
> $(OBJ): $(SRC)
> $(F77) $(SRC) $(OPT) -o $(OBJ)
> =================================
>
> the error I get looks like this:
>
>
> =================================
> ld: library not found for -lnetcdf
> collect2: ld returned 1 exit status
> make: *** [most3_x] Error 1
> =================================
>
> so what i can;t figure out is what file is the compiler looking for? I have
> installed the netCDF packages using fink on my macbook (10.6.4). It is
> obviously looking for a library file, but what it its exact name? and where
> might i find it? I have searched around in the usual places, i.e. places
> where fink puts things, i.e. in the /sw directories.
>
> This same set up works on my older macs (10.4.xx) and things worked by just
> altering the paths in the lines above. But now, on this newer set up, I
> can't seem to get the right bits talking to each other.
>
> I have tried adding various paths after the -l flag in the OPT line above,
> but it gets me to the same place.
>
> Can someone tell me fundamentally what that OPT line in the make file is
> doing? why is there a path before the include file? but not before the
> library file?
>
> What is the -I flag and what is the -L flag? (I am guessing Include and
> Library, but then why -l?)
>
> Anyway, any help/suggestions appreciated.
>
> -jose
>
>
>
> --
> Jose C. Borrero
> Adjunct Assistant Professor
> University of Southern California
> Tsunami Research Center
> http://www.usc.edu/dept/tsunamis
>
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
**********************
"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"