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.
>From: "Dr. Craig A. Mattocks" <address@hidden> >Organization: NOAA-AOML/CIMAS, Hurricane Research Division >Keywords: 199605151821.AA27851 Craig, > >> gcc -c -O -I../libsrc dumplib.c > >> *** Error code 1 > >> Stop. > > > The next thing it is supposed to do is: > > > > gcc -o ncdump -O ncdump.o vardata.o dumplib.o > ../libsrc/libnetcdf.a ../xdr/libxdr.a ... > I can't find a "libxdr.a" file anywhere. I noticed that when I make > `all' in directory /home/root/netcdf-2.4.2/src/xdr, it archives the > xdr*.o files into the libnetcdf.a library: > > ar rcuv ../libsrc/libnetcdf.a xdr.o xdrfloat.o xdrstdio.o xdrarray.o > > so I successfully built ncdump *without* the ../xdr/libxdr.a link: > > gcc -o ncdump -O ncdump.o vardata.o dumplib.o ../libsrc/libnetcdf.a > > Is this the right thing to do? Yes. I forgot that if you use the XDR that comes with the netCDF software, it includes it in libnetcdf.a rather than making a separate XDR library. > I can build the apps in subsequent > directories (ncgen & nctest) using the same hack: > > gcc -o ncgen -O *.o ../libsrc/libnetcdf.a > ar rcuv ../libsrc/libnetcdf.a *.o > ranlib ../libsrc/libnetcdf.a Great. > but the Makefile is really "hosed". Even if I get rid of the > $(LD_XDR) symbol in the "LIBS =" line, it stops at the same > place. Ditto for "make test". I'm also getting thousands of > undefined symbols when I try "make all" in the cxx directory. > > Help!!! I guess I need to know how to proceed with the xdr stuff, > then fix my Makefile, so I don't have to build everything by hand > (and screw it all up). That sounds right to me. Since the "configure" script reported problems with the vendor-supplied XDR library: > checking XDR implementation... configure: > warning: problem with system-supplied XDR: using own we should determine why. To do this, you'll need to copy the "configure" script and edit the copy to insert an "exit" right after the above message is printed. So find something that looks like else echo "configure: warning: problem with system-supplied XDR: using own" 1>&2 XDR_LIBOBJS="xdr.o xdrfloat.o xdrstdio.o xdrarray.o" XDR_INSTALL_DEPS=installed_headers LD_XDR= fi and insert an "exit" in a new line after the "fi". Then remove any config.cache file that might exist and run the "configure" script. When it exits after printing the warning message, the directory in which it was running should contain a "conftest" executable that was built from a "conftest.c" program. Also the last part of "config.log" should contain any messages that occurred when building "conftest" (it will contain other error messages as well, but some error messages are expected in all the previous feature tests, so they can be ignored). Try running the "conftest" program, to see if it produces any useful output. See if there are any useful messages at the end of "config.log". If you can get the conftest.c program to work, then that is the key to getting netcdf to using the vendor-supplied XDR library. --Russ