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

[netCDF #SPF-148694]: Question about pointing libraries of netcdf



Rushat,

> The thing it is not a single program and over that, I did not write them.
> The developer of the code sent me this Makefile which have these two
> commands. Could you please look at the file and tell me how to setup the
> two.

Only the first line has anything tto do with netCDF.  I have no idea what the
> CMD   =       xcel
is for.

The line 
> LIBS = -lnetcdff -lnetcdf
is assuming that you have installed netCDF libraries in /usr/local/lib, so it
assumes the files libnetcdff.a and libnetcdf.a exist there, or the shared object
equivalents, such as libnetcdf.so and libnetcdff.o.

If those libraries aren't installed in that directory, the Makefile won't work. 
 If you know 
where they are installed, you could instead provide the absolute path names to 
the
library files.

--Russ

> address@hidden> wrote:
> 
> > Hi Rushat,
> >
> > > I have compiled and built the latest version of netcdf and was wondering
> > > how to point the netcdf libraries to build a code. The Makefile of the
> > code
> > > has the following two lines:
> > >
> > > LIBS = -lnetcdff -lnetcdf
> > > CMD   =       xcel
> > >
> > > and when i try compiling the code, it issues errors regarding to
> > > improper location of the mentioned libraries.
> >
> > It looks like you are trying to compile a Fortran program that uses the
> > netCDF Fortran library.  If you have netCDF version 4.1.3, you can use
> > the "nc-config" command to see how to compile it, like this:
> >
> >  nc-config --fc
> >
> > to see which Fortran compiler was used,
> >
> >  nc-config --fflags
> >
> > to see what compiler options to use, and
> >
> >  nc-config --flibs
> >
> > to see what library flags to use.
> >
> >  nc-config --all
> >
> > will show the values of all the flags.
> >
> > You might be able to compile your Fortran program like this:
> >
> >  `nc-config --fc` your-program.f90 -o your-program `nc-config --fflags
> > --flibs`
> >
> > If you have a version more recent than netCDF 4.1.3, such as
> > netcdf-4.2-rc1, which is only the C library, and netcdf-fortran-4.2,
> > which is the separate Fortran libraries, and you have installed both the
> > C and Fortran libraries, then instead of the above nc-config commands,
> > you can use nf-config commands to do the same thing.
> >
> > --Russ
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: SPF-148694
> > Department: Support netCDF
> > Priority: Normal
> > Status: Open
> >
> >
> 
> 

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



Ticket Details
===================
Ticket ID: SPF-148694
Department: Support netCDF
Priority: Normal
Status: Closed