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.
Keith, > To: "'address@hidden'" <address@hidden> > From: Keith Bigelow <address@hidden> > Subject: Problems building netCDF on Linux > Organization: . > Keywords: 199812160303.UAA06866 In the above message, you wrote: > Hello, I am trying to install the netCDF on a linux machine and the install > have several errors on the "make" portion of the install. I have checked the > document www.unidata.ucar.edu/packages/netcdf/INSTALL and offer the > following for diagnosis. > > Note: the problem may reside in the fortran compiler which is a fortran to C > converter and not a usual fortran compiler. > > Per the reporting problems I did the following: > make disclean > rm config.cache > CC=/usr/bin/cc > CPPFLAGS=-Df2cFortran > CFLAGS=-g > FC=/usr/bin/fort77 > FFLAGS="-g -Nx400 -w" > CXX=/usr/c++ > configure --prefix=/usr/local > configure.log 2>&1 > make > make.log 2>&1 ... > F. make.log > make[1]: Entering directory `/home/keithb/netcdf-3.4/src' > > Making `all' in directory /home/keithb/netcdf-3.4/src/libsrc > > make[2]: Entering directory `/home/keithb/netcdf-3.4/src/libsrc' > cc -c -O -I. -DNDEBUG attr.c The above compilation line indicates that the environment variable CC was not set to "/usr/bin/cc"; otherwise, the line would, instead, have been /usr/bin/cc -c -O -I. -DNDEBUG attr.c I suspect that you are not correctly setting the appropriate environment variables prior to executing the configure script. In csh-like shells, you have to do something like this: setenv CC /usr/bin/cc setenv CPPFLAGS -Df2cFortran setenv CFLAGS -g setenv FC /usr/bin/fort77 setenv FFLAGS "-g -Nx400 -w" setenv CXX /usr/c++ ./configure --prefix=/usr/local >&! configure.log whereas, in standard UNIX shells (sh, ksh, bash) you should do something like this: CC=/usr/bin/cc CPPFLAGS=-Df2cFortran CFLAGS=-g FC=/usr/bin/fort77 FFLAGS="-g -Nx400 -w" CXX=/usr/c++ ./configure --prefix=/usr/local > configure.log 2>&1 I.e. all the environment variables are set on the (single) command line. This is what I use. An alternative for standard UNIX shells is to set the environment variables separately like this: export CC=/usr/bin/cc export CPPFLAGS=-Df2cFortran export CFLAGS=-g export FC=/usr/bin/fort77 export FFLAGS="-g -Nx400 -w" export CXX=/usr/c++ ./configure --prefix=/usr/local > configure.log 2>&1 Note that some sh-like shells do not support the above form of the "export" command. With such shells you would have to do this instead: CC=/usr/bin/cc export CC CPPFLAGS=-Df2cFortran export CPPFLAGS CFLAGS=-g export CFLAGS FC=/usr/bin/fort77 export FC FFLAGS="-g -Nx400 -w" export FFLAGS CXX=/usr/c++ export CXX ./configure --prefix=/usr/local > configure.log 2>&1 Please try the following: 1. Go to the top-level source directory. 2. Execute the command "make distclean". 3. Remove the file "config.cache" if it exists. 4. Set the environment variables as in the above examples. 5. Execute the configure script with the environment variables set to their correct values. Redirect standard output and standard error to the file "configure.log". If an error message occurs in the output, then stop and send me the files "configure.log" and "config.log". 6. Execute the command "make". Redirect standard output and standard error to the file "make.log". If an error occurs, then stop and send me the files "make.log" and "configure.log". 7. Execute the command "make test". Redirect standard output and standard error to the file "test.log". If an error occurs, then stop and send me the files "test.log" and "make.log". 8. Execute the command "make install". Redirect standard output and standard error to the file "install.log". If an error occurs, then stop and send me the file "install.log". 9. Execute the command "make clean". -------- Steve Emmerson <http://www.unidata.ucar.edu>