Why not take the easy way out if you can?
Many Linux systems contain package management programs which allow netCDF to be installed easily. This is the prefered installation method for netCDF.
Precompiled binaries for some platforms can be found at http://www.unidata.ucar.edu/downloads/netcdf/index.jsp. Click on your platform, and copy the files from the bin, include, lib, and man directories into your own local equivalents (Perhaps /usr/local/bin, /usr/local/include, etc.).
If you are trying to get the configure or build to work, make sure you start with a clean distribution for each attempt. If netCDF failed in the “make” you must clean up the mess before trying again. To clean up the distribution:
At NetCDF World Headquarters (in sunny Boulder, Colorado), as part of the wonderful Unidata organization, we have a wide variety of computers, operating systems, and compilers. At night, house elves test netCDF on all these systems.
Output for the netCDF test platforms can be found at http://www.unidata.ucar.edu/netcdf/builds.
Compare the output of your build attempt with ours. Are you using the same compiler? The same flags? Look for the configure output that lists the settings of CC, FC, CXX, CFLAGS, etc.
On some systems you have to set environment variables to get the configure and build to work.
For example, for a 64-bit IRIX install of the netCDF-3.6.2 release, the variables are set before netCDF is configured or built. In this case we set CFLAGS, CXXFLAGS, FCFLAGS, and FFLAGS.
flip% uname -a IRIX64 flip 6.5 07080050 IP30 mips flip% setenv CFLAGS -64 flip% setenv CXXFLAGS -64 flip% setenv FFLAGS -64 flip% setenv FCFLAGS -64 flip% make distclean;./configure;make check
If your platform isn't listed on the successful build page, see if another friendly netCDF user has sent in values for environment variables that are reported to work: (http://www.unidata.ucar.edu/netcdf/other-builds.html).
If you build on a system that we don't have at Unidata (particularly if it's something interesting and exotic), please send us the settings that work (and the entire build output would be nice too). Send them to firstname.lastname@example.org.
For netCDF to build correctly, you must be able to compile C from your environment, and, optionally, Fortran 77, Fortran 90, and C++. If C doesn't work, netCDF can't compile.
What breaks a C compiler? Installation or upgrade mistakes when the C compiler was installed, or multiple versions or compilers installed on top of each other. Commercial compilers frequently require some environment variables to be set, and some directories to appear ahead of others in your path. Finally, if you have an expired or broken license, your C compiler won't work.
If you have a broken C compiler and a working C compiler in your PATH, netCDF might only find the broken one. You can fix this by explicitly setting the CC environmental variable to a working C compiler, and then trying to build netCDF again. (Don't forget to do a “make distclean” first!)
If you can't build a C program, you can't build netCDF. Sorry, but that's just the way it goes. (You can get the GNU C compiler - search the web for “gcc”).
If netCDF finds a broken Fortran 90, Fortran 77, or C++ compiler, it will report the problem during the configure, and then drop the associated API. For example, if the C++ compiler can't compile a very simple test program, it will drop the C++ interface. If you really want the C++ API, set the CXX environment variable to a working C++ compiler.
If none of the above help, try our troubleshooting section: See Troubleshooting.
Also check to see of your problem has already been solved by someone else (see Finding Help).
If you still can't get netCDF to build, report your problem to Unidata, but please make sure you submit all the information we need to help (see Reporting Problems).