Previous: The NetCDF Web Site Next: Getting Support Table of contents Frames 2011 Unidata NetCDF Workshop > Overview of netCDF

3.6 Installing netCDF
NetCDF is easy to build and install from source.

Binary distributions of various versions of netCDF are available for some platforms from package management systems such as dpkg, RPM, fink, MacPorts, Homebrew, OpenCSW, OpenPKG, and the FreeBSD Ports Collection.

On many platforms, tou can build the latest netCDF release from source, by downloading distribution and running two commands:

     ./configure
     make check install

For the most recent netCDF version, shared libraries are built by default. To build static libraries instead, use:

     ./configure --disable-shared
     make check install

Many other options are available for configuring netCDF builds. Use the --help option to learn more.

     ./configure --help

If you want to use the netCDF-4/HDF5 data format, you must first install the zlib and HDF5 libraries. Then set your LDFLAGS and CPPFLAGS environment variables so that those libraries and their associated include files can be found before running the configure script:

     LDFLAGS=-L/my/local/lib CPPFLAGS=-I/my/local/include \\
     ./configure --prefix=/where/to/install
     make check install

By default. netCDF is installed in /usr/local, so no need for --prefix if that's where you want it.

You can include support for other optional libraries (HDF4 SD library, UDUNITS, libcf) installed in the same directory as netCDF by using additional configure options.

Frequently you will want to set some flags for the pre-processors, compilers, and linker.

LDFLAGS - Loader flags
CPPFLAGS - C pre-processor flags
CFLAGS - C compiler flags
FCFLAGS - Fortran compiler (77 & 90) flags
FFLAGS - Fortran 77 (only) compiler flags
F90FLAGS - Fortran 90 (only) compiler flags
CXXFLAGS - C++ compiler flags
LIBS - Library flags

If you run into problems, check these sources for help:

 


Previous: The NetCDF Web Site Next: Getting Support Table of contents Frames 2011 Unidata NetCDF Workshop > Overview of netCDF