This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Nello, >Date: Wed, 31 Jul 1996 20:25:19 +0200 >From: Super-User <address@hidden> >Organization: IRPEM-CNR >To: Steve Emmerson <address@hidden> >Subject: Re: 960731: NetCDF 2.4.2: undefined XDR symbols >Keywords: 199607301748.AA18939 In the above message you wrote: > adria{root}-> uname -a > SunOS adria 5.5 Generic sun4u sparc SUNW,Ultra-1 > adria{root}-> ar t /usr/lib/libc.a | grep xdr > adria{root}-> ar t /usr/lib/libnsl.a | grep xdr > xdr.o > xdr_array.o > xdr_float.o > xdr_mem.o > xdr_rec.o > xdr_refer.o > xdr_sizeof.o > xdr_stdio.o > rpcb_st_xdr.o > yp_b_xdr.o > yp_xdr.o > nis_xdr.o > nis_cback_xdr.o So, there are no XDR functions in the default, C, runtime library. I wonder why the configure script thought there was. > adria{root}-> configure --prefix=/usr/local > creating cache ./config.cache ... > checking for XDR library... -lnsl The above line is the one that's relevant. It looks like it worked this time. > checking XDR implementation... ok ... > adria{root}-> make all > > making `all' in directory /opt/util/netcdf/netcdf-2.4.2/src/port ... > returning to directory /opt/util/netcdf/netcdf-2.4.2/src Looks like you built the netCDF package OK. > Yes, NrtCDF seems now to be correctly installed, but I still obtained > the error message > ld: fatal: library -lnetcdf: not found > when compiling a program using NetCDF library; then I tried to copy the > file libnetcdf.a from the /usr/local/lib directory to the usr/lib > directory, and recompiling the error massage is this one: > Undefined first referenced > symbol in file > xdr_enum /usr/lib/libnetcdf.a(array.o) > xdr_float /usr/lib/libnetcdf.a(cdf.o) > xdr_int /usr/lib/libnetcdf.a(array.o) > xdr_vector /usr/lib/libnetcdf.a(sharray.o) > xdr_u_long /usr/lib/libnetcdf.a(array.o) > xdr_double /usr/lib/libnetcdf.a(cdf.o) > xdr_long /usr/lib/libnetcdf.a(dim.o) > xdr_opaque /usr/lib/libnetcdf.a(array.o) > ld: fatal: Symbol referencing errors. No output written to ./oag > *** Error code 1 > > What do you think? I think that, when you build something that uses the netCDF library, you need to specifiy the following on the link-line: -lnetcdf -lnsl The first reference will obtain the netCDF libary (in /usr/lib) and the seconds will obtain the requisite XDR functions (in /usr/lib/libnsl.x). Please let me know if this helps. -------- Steve Emmerson <address@hidden>