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

Re: 970722: xdr trouble linking netcdf



>To: address@hidden
>From: address@hidden (Jelena Marshak)
>Subject: Can not read CDF data! Please HELP!
>Organization: .
>Keywords: 199707221407.IAA29125

Hi Jelena,

> I am trying to read the data written in netCDF format,
> and I am stuck at compilation:
> 
> [fram] /j1le/cdf_read ) make readCdf
> f77 -L/usr/local/lib -o readCdf readCdf.o   \
>                 -lnetcdf -ludunits -ludport
> Undefined                       first referenced
>  symbol                             in file
> xdr_enum                            /usr/local/lib/libnetcdf.a(array.o)
> xdr_float                           /usr/local/lib/libnetcdf.a(cdf.o)
> xdr_int                             /usr/local/lib/libnetcdf.a(array.o)
> xdr_vector                          /usr/local/lib/libnetcdf.a(sharray.o)
> xdr_u_long                          /usr/local/lib/libnetcdf.a(array.o)
> xdr_double                          /usr/local/lib/libnetcdf.a(cdf.o)
> __eprintf                           /usr/local/lib/libudunits.a(utlib.o)
> xdr_long                            /usr/local/lib/libnetcdf.a(dim.o)
> xdr_opaque                          /usr/local/lib/libnetcdf.a(array.o)
> ld: fatal: Symbol referencing errors. No output written to readCdf
> make: *** [readCdf] Error 1

The readCdf package you are trying to build is CDC software rather than
Unidata software, and the problem you are encountering appears to be a
symptom of the Makefile for readCdf not providing all the necessary
library flags for your system.  With the version of netCDF you have
installed (probably version 2.4.3?), the system XDR libraries are also
needed, and these are found in different places on different systems.
(The current version 3.3.1 of netCDF requires no system XDR libraries).

So, for example, if you are trying to compile on a Solaris system, you
need to add "-lnsl" to the loader flags, probably by redefining the
following macro in the readCdf Makefile:

  NETCDFLIBS = -lnetcdf -lnsl

Some other systems look in other places for the XDR functions,
e.g. -llibsun or -lxdr.  The Makefile in your netCDF installation
directory will have the correct flag as the value of the LIBS macro.

Alternatively, you can just get and install the current 3.3.1 version of
netCDF, available from

   ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.Z

and then things should work fine without needing a vendor XDR library.

--Russ

_____________________________________________________________________

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