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.
Youcheng, I'm forwarded the message below from someone who just built netCDF successfully under Linux, in case this helps with the problems with segmentation faults that you are encountering. --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu ------- Forwarded Message Date: Sat, 04 May 1996 09:21:29 -0600 From: Unidata Support <address@hidden> To: address@hidden Subject: 960504: Linux - netCDF 2.4.2 - ------- Forwarded Message >To: address@hidden >cc: address@hidden >From: Richard van Hees <address@hidden> >Subject: Linux - netCDF 2.4.2 >Organization: . >Keywords: 199605041453.AA01952 Hi, Congratulations! I have just installed the netCDF-library (version 2.4.2) on my Linux-PC, and it compiled just out of the box. THANKS. I wrote you in an earlier e-mail that I could install netcdf-2.3, without any real problems, but this is the first time that I could install everything by just editing CUSTOMIZE and type: "make", "make test" and "make install". In addition I have (for the first time) Fortran support. My Linux-PC: kernel 1.3.95 gcc 2.7.2 g++ 2.7.2 g77 0.5.18 <-- important 0.5.16 doesn't work! libc-5.3.12 libm-5.0.6 libg++.so.27.1.4 My CUSTOMIZE file (without comment): CC=gcc CFLAGS='-m486 -O2 -fomit-frame-pointer -pipe' <-- faster ??? CXX=g++ CXXFLAGS=-O -I/usr/include/g++ <-- Note the include-directory FC=g77 FFLAGS=-O prefix=/usr/local OS=linux It is possible (at least with the GNU compilers) to create shared-libraries (not only on Linux-machines!) using the appended script. Best regards Richard van Hees /================================================================\ | Richard M. van Hees | e-mail : address@hidden | | p/a IMAU | phone : +31 (0)30 2532291 | | Princetonplein 5 | fax : +31 (0)30 2543164 | | NL-3584 CC Utrecht | | | The Netherlands | | \================================================================/ #------------------ CUT HERE ------------------------------------------------ #!/bin/sh -x # # Date: 04-May-96 # # Purpose: 1) make a shared netCDF library using the gcc compiler # 2) recompile ncdump and ncgen with the shared library # # Use: Compile the netCDF software # I have used: - CC=gcc (v2.7.2) # - CFLAGS='-O2 -m486 -fomit-frame-pointer -pipe' # - CXX=g++ (libg++.so.27.1.4) # - CXXFLAGS=-O -I/usr/include/g++ # - FC=g77 (v0.5.18) # - FCFLAGS=-O # - OS=linux # Type "make_shared" # Install ncdump and ncgen by hand otherwise they are recompiled # which the static library! # # Note: only tested on a Linux-PC, gcc 2.7.2, ELF # I haven't tried to get FORTRAN-support into the shared library, # because I am not specially interested in FORTRAN 77. # # Author: R.M. van Hees # email: address@hidden # MAJOR_VERSION="2" MINOR_VERSION=".4" PATCH_VERSION=".2" SH_NAME="libnetcdf.so" SH_LIB="${SH_NAME}.${MAJOR_VERSION}${MINOR_VERSION}${PATCH_VERSION}" SH_BUILD="-shared -Wl,-soname,${SH_NAME}.${MAJOR_VERSION}" SH_OBJ='array.o attr.o cdf.o dim.o file.o iarray.o error.o globdef.o putget.o putgetg.o sharray.o string.o var.o xdrposix.o' cd libsrc rm ${SH_OBJ} make CFLAGS='-O2 -m486 -fPIC -fomit-frame-pointer -pipe' gcc ${SH_BUILD} -o ${SH_LIB} ${SH_OBJ} ln -sf ${SH_LIB} ${SH_NAME}.${MAJOR_VERSION} ln -sf ${SH_NAME}.${MAJOR_VERSION} ${SH_NAME} cd .. cd ncdump rm ncdump gcc -o ncdump ncdump.o vardata.o dumplib.o -L../libsrc -lnetcdf strip ncdump cd .. cd ncgen rm ncgen gcc -o ncgen main.o load.o ncgentab.o escapes.o getfill.o init.o close.o genlib.o -L../libsrc -lnetcdf strip ncgen cd .. - ------- End of Forwarded Message ------- End of Forwarded Message