Installing NetCDF

This document contains instructions for building and installing the netCDF package from source on various platforms. Prebuilt binary releases are available for some platforms from http://www.unidata.ucar.edu/packages/netcdf/binaries.html.

The most up-to-date version of this document is http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html.

If you encounter a problem during the installation of this package and wish to report it, then see the section Reporting Problems below.

Requirements

Depending on the platform, you may need up to 25 Mbytes of free space to unpack, build, and run the tests. You will also need a Standard C compiler. If you have compilers for FORTRAN 77, FORTRAN 90, or C++, the corresponding netCDF language interfaces may also be built and tested.

If you wish to build from source on a Windows (Win32) platform, different instructions apply. Obtain the file ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/maks.zip, unpack it in the netCDF src/ directory, and read WIN32_INSTALL.

Specifying the Environment for Building

Select and specify an appropriate build environment. If necessary, set whichever of the environment variables CC, CFLAGS, CPPFLAGS, FC, FFLAGS, CXX, CXXFLAGS, F90, and F90FLAGS (and perhaps LIBS) are needed to represent that environment.

If you don't set an environment variable, the configure script will try to figure out a reasonable value. (See Setting Environment Variables to learn how to set environment variables.)

Variable Description Notes
CC C compiler If you don't specify this, the configure script will try to find a suitable C compiler such as cc, c89, xlc, or gcc.
FC Fortran compiler (if any) Set to "" if no Fortran interface is desired. If you don't specify this, the configure script will try to find a suitable Fortran 90 or Fortran 77 compiler.
F90 Fortran 90 compiler (if any) Set to "" if no Fortran 90 interface desired. If you don't specify this, the configure script will try to find a suitable Fortran 90 compiler. Not needed if FC specifies a Fortran 90 compiler.
CXX C++ compiler Set to "" if no C++ interface is desired.
CFLAGS C compiler flags "-O" or "-g", for example
FFLAGS Fortran compiler flags "-O" or "-g", for example
F90FLAGS Fortran 90 compiler flags "-O" or "-g", for example
CXXFLAGS C++ compiler flags "-O" or "-g", for example
CPPFLAGS C preprocessor options "-DNDEBUG" to omit assertion checks, for example

The section marked Tested Systems below contains a list of systems on which we have built this package, the environment variable settings we used, and additional, important commentary.

Running the configure Script

To create the makefiles needed to build netCDF, you must run the provided configure script. Go to the top-level netCDF src/ directory.

Decide where you want to install this package. Use this for the "--prefix=" argument to the configure script below. The default installation prefix is "..", which will install the package's files in ../bin, ../lib, and ../man relative to the netCDF src/ directory.

Execute the configure script:

    ./configure --prefix=whatever_you_decided

The "--prefix=..." specification is optional; if omitted, ".." designating the parent directory will be used as a default.

The configure script will examine your computer system -- checking for attributes that are relevant to building the netCDF package. It will print to standard output the checks that it makes and the results that it finds.

The configure script will also create the file "config.log", which will contain error messages from the utilities that the configure script uses in examining the attributes of your system. Because such an examination can result in errors, it is expected that "config.log" will contain error messages. Therefore, such messages do not necessarily indicate a problem (a better indicator would be failure of the subsequent "make"). One exception, however, is an error message in "config.log" that indicates that a compiler could not be started. This indicates a severe problem in your compilation environment -- one that you must fix.

Run "make". This will build one or more netCDF libraries. It will build the basic netCDF library libsrc/libnetcdf.a. If you have Fortran 77 or Fortran 90 compilers, then the Fortran interfaces will be included in this library. If you have a C++ compiler, then the C++ interface will be built into the library cxx/libnetcdf_c++.a. This will also build the netCDF utilities ncgen(1) and ncdump(1).

Testing and Installing the Release

Run "make test" to verify the build. This will build and run "libsrc/t_nc", a simple "blunder test". It will also build and run the programs "nctest" and "nc_test", which test the version 2 and version 3 C interfaces, respectively. If you have a Fortran compiler, then this will also run the programs "ftest" and "nf_test", which test the version 2 and version 3 Fortran interfaces, respectively.

Run "make install". Try linking your applications. Let us know if you have problems (see Reporting Problems below). Port the library to other platforms. Share data.

Tested Systems

The following are environment variable settings that we've used to build netCDF-3 on various systems -- plus commentary. Take your pick if there is more than one set of settings for a particular system.

If you don't find your environment listed here, then try http://www.unidata.ucar.edu/packages/netcdf/other-builds.html for reports of successful builds of this package in environments to which we had no access.


AIX

AIX gale 3 4 001330614C00

        The following works:

    CC=/bin/xlc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/xlf
    FFLAGS=-O
    F90=/bin/xlf90
    F90FLAGS='-qsuffix=f=f90'   # Note the lack of a "-O" option
    CXX=/bin/xlC

    --------

        Due to the addition of the "-O" option to the Fortran-90
        compilation flags, the following settings result (on our
        AIX system, at least) in failure and the error message
        "1517-011: (U) Compilation ended.  No more system resources
        available".  We do not know the cause.

        The problem occurs when compiling the file "f90/netcdf.f90".  If
        you want optimization, then you might use the following settings
        but manually compile the problem file without optimization if
        and when your "make" fails.

    CC=/bin/xlc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/xlf
    FFLAGS=-O
    F90=/bin/xlf90
    F90FLAGS='-O -qsuffix=f=f90'        # might not compile "f90/netcdf.f90"
    CXX=/bin/xlC

    --------

        Carlie Coats reported that the following was necessary on an IBM
        AIX SP system for 64-bit mode:

    ARFLAGS='-X 64 cru'
    NMFLAGS='-X 64'

BSD/OS

BSD/OS emo 4.0 BSDI BSD/OS 4.0 i386

    The following is for netCDF 3.5.

    NOTE: Use the GNU make(1) utility (gmake(1)) rather than
    /usr/bin/make to build the package.  The latter utility doesn't
    support the "include" syntax used in the makefiles.

    CC=/usr/bin/cc                      # gcc version 2.7.2.1
    CPPFLAGS="-DNDEBUG -Df2cFortran"    # "-Df2cFortran" is necessary if the
                                        # Fortran "compiler" is fort77(1).
    CFLAGS=-O
    FC=/usr/local/bin/fort77            # actually an f2c(1)-using script
    FFLAGS="-O -w -Nx400"               # "-Nx400" allows fortran/netcdf.inc
                                        # to have many EXTERNAL statements
    CXX=/usr/bin/g++                    # gcc version 2.7.2.1

HP-UX

HP-UX robin B.10.20 E 9000/715 2010262449 8-user license

      Note:  Subtle problems that may be difficult to diagnose
      reportedly result if a C application compiled without the "+a" C
      flag is linked against the library compiled with the "+a" C flag.

    CC=/bin/c89
    CPPFLAGS="-D_HPUX_SOURCE -DNDEBUG"
    CFLAGS=-O
    FC=/opt/fortran/bin/fort77          # might be /usr/bin/fort77 instead
    FFLAGS="-O3 -w"
    CXX=/usr/bin/CC

HP-UX robin B.11.00 E 9000/715 2010262449 8-user license

    CC=/bin/c89
    CPPFLAGS='-DNDEBUG -D_HPUX_SOURCE -w'       # "-w" suppresses ignorable 
                                                # warnings
    CFLAGS=-O
    FC=/opt/fortran/bin/fort77          # might be /usr/bin/fort77 instead
    FFLAGS='-O -w'          # do not use "-O3"; it causes
                    # "make ncgen/test" to fail
    CXX=/usr/bin/CC

    The above resulted in ignorable errors like the following:

        cpp: "/usr/include/sys/time.h", line 492: warning 2001: Redefinition of macro FD_ISSET.
        cpp: "/usr/include/sys/time.h", line 492: warning 2001: Redefinition of macro FD_ISSET.
        cpp: "/usr/include/sys/time.h", line 492: warning 2001: Redefinition of macro FD_ISSET.

IRIX

IRIX dana 5.3 11091811 IP20 mips

    The following is for netCDF 3.4; later version were not tested.

    CC=/bin/cc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/f77
    FFLAGS=-O
    CXX=/bin/CC

    The above results in harmless warnings like the following:

        "ncvalues.hh", line 40: warning(3161): integer conversion \
        resulted in a change


IRIX chevy 6.2 03131015 IP22

        IRIX f90 Note: On IRIX 6.x platforms with version 7 compilers,
        the f90 compiler accepts 'integer*1', while f77
        accepts both 'integer*1' and 'byte'. Using
        FC=f90 forces the configure script to select 'integer*1'.
        The resulting *.inc files and test configurations will then
        work with either compiler.

    --------

    CC=/bin/c89
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/f77
    FFLAGS=-O
    CXX=/bin/CC

    The above results in harmless warnings like the following:

        "ncvalues.hh", line 40: warning(3161): integer conversion \
        resulted in a change

    --------

    CC="/bin/cc -n32"
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC="/bin/f77 -n32"
    FFLAGS=-O
    CXX="/bin/CC -n32"

    The above results in harmless warnings like the following:

        "ncgen.y", line 1127: warning(1172): subscript out of range

IRIX chevy 6.5 11051729 IP22

        See IRIX f90 note above.

    --------

    CC=/bin/c89                 # MIPSpro Compilers: Version 7.3.1.1m
    CPPFLAGS=-DNDEBUG
    CFLAGS='-O -o32'
    FC=/bin/f77                 # MIPSpro Compilers: Version 7.3.1.1m
    FFLAGS='-O -o32'
    CXX=/bin/CC                 # MIPSpro Compilers: Version 7.3.1.1m
    CXXFLAGS='-O -o32'

    --------

    CC=/bin/c89                 # MIPSpro Compilers: Version 7.3.1.1m
    CPPFLAGS=-DNDEBUG
    CFLAGS='-O -n32'
    FC=/bin/f90                 # MIPSpro Compilers: Version 7.3.1.1m
    FFLAGS='-cpp -O -n32'
    CXX=/bin/CC                 # MIPSpro Compilers: Version 7.3.1.1m
    CXXFLAGS='-O -n32'

    --------

    The above result in the following harmless warnings:

        "ncgen.y", line 1127: warning(1172): subscript out of range
        "ncgen.y", line 1128: warning(1172): subscript out of range

IRIX64

IRIX64 flip 6.4 02121744 IP30

        See IRIX f90 Note above.

    --------

    CC=/bin/cc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/f77
    FFLAGS=-O
    CXX=/bin/CC

    The above results in harmless warnings like the following:

        "ncgen.y", line 1127: warning(1172): subscript out of range


IRIX64 flip 6.5 11051732 IP30

        See IRIX f90 Note above.

    --------

    CC=/bin/cc                  # MIPSpro Compilers: Version 7.3.1.1m
    CPPFLAGS=-DNDEBUG
    CFLAGS='-O -o32'
    FC=/bin/f77                 # MIPSpro Compilers: Version 7.3.1.1m
    FFLAGS='-O -o32'
    CXX=/bin/CC                 # MIPSpro Compilers: Version 7.3.1.1m
    CXXFLAGS=-o32

    --------

    CC=/bin/cc                  # MIPSpro Compilers: Version 7.3.1.1m
    CPPFLAGS=-DNDEBUG
    CFLAGS='-O -n32'
    FC=/bin/f90                 # MIPSpro Compilers: Version 7.2.1.3m
    FFLAGS='-cpp -O -n32'
    CXX=/bin/CC                 # MIPSpro Compilers: Version 7.3.1.1m
    CXXFLAGS=-n32

    --------

    CC=/bin/cc                  # MIPSpro Compilers: Version 7.3.1.1m
    CPPFLAGS=-DNDEBUG
    CFLAGS='-O -64'
    FC=/bin/f90                 # MIPSpro Compilers: Version 7.2.1.3m
    FFLAGS='-cpp -O -64'
    CXX='/bin/CC -64'           # MIPSpro Compilers: Version 7.3.1.1m
    CXXFLAGS=-64

    --------

    All the above result in the following, harmless warnings during the
    "make" step:

        "ncgen.y", line 1127: warning(1172): subscript out of range
        "ncgen.y", line 1128: warning(1172): subscript out of range

    At the UPC, the following problem occurs during the very last step
    of a "make install" because our IRIX64 troff(1) system is hosed:

        /usr/lib/makewhatis -M /tmp/netcdf-3.4.1/man /tmp/netcdf-3.4.1/man/whatis
        troff: fatal error: can't open `/usr/lib/tmac/tmac.an': No such file or directory
        eqn:fatal error: can't open `/usr/pub/eqnchar': No such file or directory
        ...

    This results in the creation of an empty "$(MANDIR)/whatis" file.

Linux

Linux sunshine 2.2.1 #5 SMP Wed Feb 3 18:44:58 MST 1999 i686 unknown

    CC=/usr/bin/egcs            # egcs-2.91.66
    CPPFLAGS='-DNDEBUG -Df2cFortran'
    CFLAGS=-O
    FC=/usr/bin/g77             # GNU Fortran 0.5.24-19981002
    FFLAGS="-O -Wno-globals"
    CXX=/usr/bin/g++            # egcs-2.91.66

    --------

    CC=/usr/bin/egcs            # egcs-2.91.66
    CPPFLAGS="-DNDEBUG -Df2cFortran"    # "-Df2cFortran" is necessary if
                                        # the Fortran "compiler" is fort77(1).
    CFLAGS=-O
    FC=/opt/bin/fort77          # actually an f2c(1)-using perl script.
                                # Support email archive contains a report that
                                # /usr/bin/g77 (version 0.5.21) also works.
    FFLAGS="-O -Nx400 -w"       # "-Nx400" allows fortran/netcdf.inc to
                                # have many EXTERNAL statements
    CXX=/usr/bin/g++            # egcs-2.91.66

    If you get errors similar to the following:

        ... undefined reference to `GLOBAL_OFFSET_TABLE_'

    then your gcc(1) compiler probably doesn't support ELF binaries --
    though your kernel does.  Try gcc(1) version 2.7.2 or later.

    --------

    pgf90 USERS: The following is also reported to work:

    CC=/usr/bin/egcs            # gcc version egcs-2.90.29 980515 
                                # (egcs-1.0.3 release)
    CPPFLAGS='-DNDEBUG -DpgiFortran'    # necessary for correct compilation
    CFLAGS=-O
    FC=pgf90                    # Portland Group Fortran-90 compiler
    FFLAGS="-O -w"              # "-w" disables warnings
    CXX=/usr/bin/g++            # gcc version egcs-2.90.29 980515 
                                # (egcs-1.0.3 release)

Linux aqua 2.2.5-16 #1 Tue Apr 27 04:55:03 EDT 1999 alpha unknown

    The following was reported to work on an Alpha Linux workstation:

    CC=/usr/bin/cc
    CPPFLAGS='-DNDEBUG -Df2cFortran'
    CFLAGS=-O
    FC=/usr/bin/fort            # Compaq Fort F77/F90 Compiler
    FFLAGS=-O
    CXX=/usr/bin/c++

MacOS X

http://www.omnigroup.com/mailman/archive/macosx-dev/2000-October/005541.html
Darwin burns 1.2 Darwin Kernel Version 1.2: Wed Aug 30 23:32:53 PDT 2000; root:xnu/xnu-103.obj~1/RELEASE_PPC  Power Macintosh powerpc

    If no Fortran interface is required,

    FC=""
    M4FLAGS=""

    --------

    If f2c is installed for use with the Fortran interface:

    CPPFLAGS=-Df2cFortran
    FC=/bin/fc
    M4FLAGS=""
    FFLAGS=-w 
    FPP="cc -E -C"

OSF1

OSF1 ernie V4.0D 878 alpha

    NB: Use of "g++" in the following might require that the
    LD_LIBRARY_PATH environment variable be set to reference the
    directory that contains the "g++" sharable library, e.g.

        export LD_LIBRARY_PATH=/opt/gnu/lib

    CC=/bin/c89
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/bin/f77
    FFLAGS=-O
    CXX=g++             # 2.8.1

    The above results in a harmless warning like the following:

        cc: Warning: ncgen.l, line 26: The redefinition of the macro
        "YY_BREAK" conflicts with a current definition because the
        replacement lists differ.  The redefinition is now in effect.

SunOS4

SunOS gummo 4.1.4 11 sun4m

        SunOS 4 will complain bitterly due to its hosed (non ANSI) 
        <string.h>. This is harmless. May be suppressed by CFLAGS=-w .

    CC=acc              # SC3.0.1 7/13/94
    CPPFLAGS=-DNDEBUG   # Because the SunOS 4 assert() macro is non ANSI,
                        # always compile the library -DNDEBUG on these systems.
    CFLAGS="-O -temp=." # Insufficient room in "/tmp/" for temporary files
                        # => we use current directory.  You might be OK.
    FC=f77              # SC3.0.1 7/13/94
    FFLAGS="-O -w -temp=."
                        # Insufficient room in "/tmp/" for temporary files
                        # => we use current directory.  You might be OK.
    CXX=CC              # SC3.0.1 7/13/94
    LIBS=-ldl           # For some reason our linker needed to be told
                        # to use the dynamic-link library.  This shouldn't
                        # have occurred and might not be necessary outside 
                        # the Unidata Program Center.
    F90=''              # necessary because "f77 name.f90" returns success

    --------

    CC=gcc              # gcc version 2.7.2.2
    CPPFLAGS="-DNDEBUG -D__USE_FIXED_PROTOTYPES__"
                        # -D__USE_FIXED_PROTOTYPES__ shouldn't hurt and is
                        # necessary for some gcc(1) installations.
    CFLAGS=-O
    FC=f77              # SC3.0.1 7/13/94
    FFLAGS="-O -w"
    CXX=g++             # gcc version 2.7.2.2
    LIBS="-L/usr/lang/SC3.0.1/lib -lansi"       # To obtain memmove().  Given
                        # this dependency, one might be better off using
                        # acc(1) instead of gcc(1).
    F90=''              # necessary because "f77 name.f90" returns success

SunOS meeker 4.1.3 3 sun4m

        The following is for netCDF 3.3; later versions were not tested.

        SunOS 4 will complain bitterly due to its hosed (non ANSI) 
        <string.h>. This is harmless. May be suppressed by CFLAGS=-w .

    CC=acc              # acc: SC3.0.1 7/13/94
    CPPFLAGS=-DNDEBUG   # Because the SunOS 4 assert() macro is non ANSI,
                        # always compile the library -DNDEBUG on these systems.
    CFLAGS=-O
    FFLAGS="-O -w"
        796.8u 240.6s 19:45 87% 0+2780k 839+7664io 2445pf+0w
    CFLAGS=-O4
    FFLAGS="-O4 -w"
        1728.8u 290.5s 36:46 91% 0+3896k 988+8896io 5034pf+0w

Solaris

SunOS 5.7 sun4u sparc SUNW,Ultra-2

    CC=/opt/SUNWspro/bin/c89    # Sun WorkShop 6 2000/06/19 C 5.1
                                #   Patch 109491-02
                                # Also works with cc
    FC=/opt/SUNWspro/bin/f90    # Sun WorkShop 6 2000/04/07 FORTRAN 95 6.0
                                # also works with f77
    FFLAGS="-w"                 # disables an ignorable warning
    CXX=/opt/SUNWspro/bin/CC    # Sun WorkShop 6 2000/04/07 C++ 5.1

    --------

    CC=/opt/SUNWspro/bin/c89    # Sun WorkShop 6 2000/06/19 C 5.1
                                #   Patch 109491-02.
                                # Also works with cc
    CFLAGS="-xarch=v9"          # 64-bit SPARC binary
    FC=/opt/SUNWspro/bin/f90    # Sun WorkShop 6 2000/04/07 FORTRAN 95 6.0
                                # also works with f77
    FFLAGS="-w -xarch=v9"       # "-w" disables an ignorable warning
    CXX=/opt/SUNWspro/bin/CC    # Sun WorkShop 6 2000/04/07 C++ 5.1
    CXXFLAGS="-xarch=v9"

    --------

    CC=gcc                      # 2.95.2
                                # Also works with cc
    FC=g77                      # GNU Fortran 0.5.25 19991024 (release)
    CXX=g++                     # 2.95.2
    CPPFLAGS=-Df2cFortran       # necessary for Fortran API
    FC=                         # g77 and f90 seem to be incompatible

SunOS 5.7 i86pc i386

    CC=/opt/SUNWspro/bin/c89
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/opt/SUNWspro/bin/f77
    FFLAGS="-O -erroff=WDECL_LOCAL_NOTUSED"     # "-erroff=..." turns off 
                                                # an ignorable warning.
    CXX=/opt/SUNWspro/bin/CC

SunOS 5.8 (alias Solaris 8, Solaris 2.8)

    CC=/opt/SUNWspro/bin/cc     # WorkShop Compilers 5.0 98/12/15 C 5.0
    FC=/opt/SUNWspro/bin/f77    # WorkShop Compilers 5.0 98/12/15 FORTRAN 77 5.0
    FFLAGS=-w
    CXX=/opt/SUNWspro/bin/CC    # WorkShop Compilers 5.0 98/12/15 C++ 5.0

    --------

UNICOS

sn9607 (UNICOS) ouray 10.0.0 and.2 CRAY J90
        Cray Standard C Version 6.0.1.3 03/04/98 14:55:01
        Cray CF90 Version 3.0.1.3 03/04/98 14:55:17
        Cray C++ Version 3.0.1.3 03/04/98 15:13:33
Fri Mar  6 14:37:42 MST 1998

    The "-F" option in the following causes the Fortran compiler to
    1) do its own preprocessing of *.F files rather than use a separate
    utility; and 2) substitute macros in code as well as in conditional
    compilation directives (which is necessary).

    Before executing make(1), manually copy the file "libsrc/ncx_cray.c"
    to file "libsrc/ncx.c".  See the commentary at the top of this file
    for more information.

    --------

    # The following requires about 46.3 MB for the source build-and-test
    # directory hierarchy, and about 6.8 MB for the installation
    # directory hierarchy.
    CC=/opt/ctl/bin/cc
    CPPFLAGS=
    CFLAGS=-O3                  # -g works as well
    FC=/opt/ctl/bin/f90
    FFLAGS="-g -F -dp"     # "-F" enables macro substitution in code.
                                # "-dp" enables DOUBLEPRECISION/double
                                #     equivalence.
    CXX=/opt/ctl/bin/CC
    CXXFLAGS=                   # "-h char" may be necessary with
                                # older rev C++ compilers

        The 'C' compiler may run out of memory compiling libsrc/putget.c
        using "-O3" option. 
        cc-7951 cc: LIMIT File = putget.c, Line = 6617
                Insufficient memory is available for compiler to continue.
        (We don't see this problem anymore.) You can work around this
        by compiling -O2
                cd libsrc; c89 -c -O2 -I.  -DNDEBUG putget.c
        and continuing with the build.

        The C compiler issues some warnings:
                cc-7212 c89: ... Variable "xx" is used before it is defined.
        We believe these are unfounded. Since the only appear with
        optimization, they may be due to the compiler's inlining strategy.

        In nf_test, you can ignore the following warning:
 ldr-290 f90: CAUTION 
     Duplicate entry point 'HASH' was encountered.
     Entry in module 'HASH' from file 'util.o' has been used.
     Entry in module '$ZZFFLOW' from file '/opt/ctl/mpt/mpt/lib/libc.a' has
     been ignored.


sn4031 (UNICOS) antero 9.0.2.5 and.15 CRAY C90
        Cray Standard C Version 6.0.1.3 03/04/98 15:01:58
        Cray CF90 Version 3.0.1.3 03/04/98 15:02:10
        Cray C++ Version 3.0.1.3 03/06/98 15:23:50
Fri Mar  6 15:43:25 MST 1998

    This example is for a CRAY C90 and *not* for a CRAY T3D that is
    being front-ended by a C90.

    Before proceeding with make(1), manually copy the file
    "libsrc/ncx_cray.c" to file "libsrc/ncx.c".  See the commentary at
    the top of this file for more information.

    CC=cc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O3
    FC=f90
    FFLAGS="-g -F -dp" # -F is equiv to old -Wp-F

        The 'C' compiler may run out of memory compiling libsrc/putget.c
        using "-O3" option. 
        cc-7951 cc: LIMIT File = putget.c, Line = 6617
                Insufficient memory is available for compiler to continue.
        (We don't see this problem anymore.) You can work around this
        by compiling -O2
                cd libsrc; c89 -c -O2 -I.  -DNDEBUG putget.c
        and continuing with the build.

        The C compiler issues some warnings:
                cc-7212 c89: ... Variable "xx" is used before it is defined.
        We believe these are unfounded. Since the only appear with
        optimization, they may be due to the compiler's inlining strategy.


sn4031 (UNICOS) antero 9.0.2.5 and.15 CRAY C90 TARGET cray-t3d
        Cray Standard C Version 5.0.5.0  (d34p55m295a41) Mar  6 1998  15:51:17
        Cray CF90 Version 2.0.4.0 03/06/98 15:51:53
        Cray C++ Version 2.0.4.0 03/06/98 15:52:20
Fri Mar  6 15:52:34 MST 1998

    This example is for a CRAY T3D that is being front-ended by a CRAY
    C90 and *not* for the C90 itself.

    Have /mpp/bin at the head of your PATH.

    Set this environment variable so that the configure script
    (and tests) will be run on the t3d.
        TARGET=cray-t3d

    Set this environment variable so that the configure script
    (and tests) will be run on a single processor of the t3d.
        MPP_NPES=1

    CC=cc
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=f90
    FFLAGS="-g -F -dp"
    CXX=""              # problems compiling cplusplus, use CXXFLAGS="-h char"?


sn7203 (UNICOS) t90 9.1.0.1 gfd.11 CRAY TS
        Cray Standard C Version 5.0.1.0  (d27p23g111a29) Mar  6 1998  22:56:40
        Cray CF90 Version 2.0.4.0 03/06/98 22:56:40
        Cray C++ Version 2.0.1 03/06/98 22:56:41
Fri Mar  6 22:29:16 MST 1998

    Before proceeding with make(1), manually copy the file
    "libsrc/ncx_cray.c" to file "libsrc/ncx.c".  See the commentary at
    the top of this file for more information.

    CC=cc
    CFLAGS=-O3
    FC=f90
    FFLAGS="-g -F -dp" # -O3 works as well as -g
    CXX=CC
    CXXFLAGS="-h char"          # needed with this version

        This compiler version (or environment) still chokes on libsrc/putget.c
                cc -c -O3 -I.  -DNDEBUG putget.c
        cc-7951 cc: LIMIT File = putget.c, Line = 6617
        Insufficient memory is available for compiler to continue.
        Recompile manually at lower optimization level.
        cd libsrc ; cc -c -O2 -I. -DNDEBUG putget.c



sn6602 (UNICOS) t3e 2.0.2.15 unicosmk CRAY T3E
        Cray Standard C Version 5.0.3.0  (d29p35m275a35) Mar  7 1998  00:42:04
        Cray CF90 Version 2.0.3.4 03/07/98 00:42:05
        Cray C++ Version 2.0.3 03/07/98 00:42:06
Sat Mar  7 1998

        CC=cc
        CFLAGS=-O3
        FC=f90
        FFLAGS='-g -F -M1110'
        CXX=CC
        CXXFLAGS="-h char"              # needed with this version


        'C' compiler still chokes on libsrc/putget.c
                c89 -c -O3 -I.  -DNDEBUG putget.c
                cc-7951 c89: LIMIT File = putget.c, Line = 6617
                Insufficient memory is available for compiler to continue.
        (56% of the way through the file. This is with a pragma to
        prevent inlining of odo1.)
        Recompile manually at lower optimisation level.
        cd libsrc ; cc -c -O2 -I. -DNDEBUG putget.c

ULTRIX

ULTRIX curly 4.5 0 RISC

        The following is for netCDF 3.3; later versions were not tested.

    CC=gcc              # gcc version 2.7.2
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O
    FC=/usr/bin/f77
    FFLAGS="-O -fpe1"   # "-fpe1" is necessary to allow the netCDF
                        # package to return NC_ERANGE rather than generate
                        # SIGFPE (which would terminate the program)
    CXX=g++             # version 2.7.2
    LIBS=/usr/local/gnu/lib/gcc-lib/mips-dec-ultrix4.5/2.7.2/libgcc.a
                        # LIBS is needed because even Fortran programs
                        # will references the GNU C library due to CC=gcc

ULTRIX milton 4.4 0 VAX

    CC=gcc              # gcc version 2.7.2
    CPPFLAGS=-DNDEBUG
    CFLAGS=-O           # If you use this option, then you will have to
                        # *manually* compile libsrc/ncx.c
    FC=                 # The Fortran interface can't be built because the
                        # f77(1) compiler can't handle underscores in names 
                        # and doesn't support exclamation points as comment
                        # delimiters.  Try g77(1)?
    CXX=g++             # g++ version 2.7.2

        NOTE: If you use gcc(1) with the "-O" option in CFLAGS, then
        gcc(1)'s optimizer will probably corrupt the structure layouts
        in "libsrc/ncx.c".  The symptom of this is that "libsrc/t_nc"
        fails during the "make test".  Thus, you will probably have to
        manually compile the file "libsrc/ncx.c" -- without the "-O"
        option -- before executing the "make".  For example:

            $ ./configure
            ...
            $ cd libsrc
            $ make ncx.o CFLAGS=
            ...
            $ cd ..
            $ make
            ...

    It appears that, if you need to build the netCDF-3 Fortran interface
    on a VAX ULTRIX system, we're afraid you're on your own (we couldn't
    do it).  You might try using the GNU Fortran compiler g77(1) instead
    of the native Fortran compiler.  We are happy to advise in this
    effort but would be unwilling, at this time, to modify the code
    solely to support this (now ancient) system.

Porting Notes

The configure and build system should work on any system which has a modern "sh" shell, "make", and so on. The configure and build system is less portable than the "C" code itself, however. You may run into problems with the "include" syntax in the Makefiles. You can use GNU make to overcome this, or simply manually include the specified files after running configure.

If you can't run the configure script, you will need to create libsrc/ncconfig.h and fortran/nfconfig.inc. Start with libsrc/ncconfig.in and fortran/nfconfig.in and set the defines as appropriate for your system.

Operating system dependency is isolated in the "ncio" module. We provide two versions. posixio.c uses POSIX system calls like "open()", "read()" and "write(). ffio.c uses a special library available on CRAY systems. You could create other versions for different operating systems. The program "t_ncio.c" can be used as a simple test of this layer.

Numerical representation dependency is isolated in the "ncx" module. As supplied, ncx.m4 (ncx.c) supports IEEE floating point representation, VAX floating point, and CRAY floating point. BIG_ENDIAN vs LITTLE_ENDIAN is handled, as well as various sizes of "int", "short", and "long". We assume, however, that a "char" is eight bits.

There is a separate implementation of the ncx interface available as ncx_cray.c which contains optimizations for CRAY vector architectures. Move the generic ncx.c out of the way and rename ncx_cray.c to ncx.c to use this module. By default, this module does not use the IEG2CRAY and CRAY2IEG library calls. When compiled with aggressive inlining and optimization, it provides equivalent functionality with comparable speed and clearer error semantics. If you wish to use the IEG library functions, compile this module with -DUSE_IEG.

Setting Environment Variables

If you don't know what environment variables are or how to set them, then read this section; otherwise, you may safely skip it.

An environment variable is a named parameter that is managed by a user's shell program and which the shell makes available to the utilities that it executes (for example, a configure script). The following are examples of typical environment variables:

        NAME                    EXAMPLE VALUE
        ----                    -------------
        USER                    steve
        HOME                    /home/steve
        PATH                    /bin:/usr/bin:/home/steve/bin

You may obtain a listing of your environment variables by executing the command "env".

The way in which an environment variable is defined and set depends upon the shell the user is using. A user of a csh-like shell (e.g. csh, tcsh) might do the following:

    % setenv CC c89
    % setenv CPPFLAGS "-O -DNDEBUG"
whereas, the user of the standard UNIX shell (e.g. sh, ksh, bash) might, equivalently, do the following:
    $ export CC=c89
    $ export CPPFLAGS="-O -DNDEBUG"
In both cases, the quotes above are necessary to delimit a value that contains embedded whitespace. They do not, however, become part of the value.

A user of a standard shell has an additional, shorthand method for defining and setting environment variables for just a single command. Environment variables can be defined and set on the command-line and take effect for only that command. For example

    $ export FOO=foo
    $ env | grep FOO
    FOO=foo
    $ FOO=bar env | grep FOO
    FOO=bar
    $ env | grep FOO
    FOO=foo

For tested systems, environment variables and their values are given as if listed by the "env" utility. Users of the standard UNIX shell may use the syntax directly; whereas, users of a csh-like shell should convert the syntax to that expected by the shell. For example, a standard shell user might do the following (taken from the SunOS 5.6 example):

    $ CC=/opt/SUNWspro/bin/c89 CPPFLAGS=-DNDEBUG CFLAGS=-O \
    FC=/opt/SUNWspro/bin/f77 FFLAGS="-O -erroff=WDECL_LOCAL_NOTUSED" \
    CXX=/opt/SUNWspro/bin/CC ./configure >configure.log 2>&1
whereas a csh-like shell user would, equivalently, do the following:
    % setenv CC /opt/SUNWspro/bin/c89
    % setenv CPPFLAGS "-DNDEBUG"
    % setenv CFLAGS -O
    % setenv FC /opt/SUNWspro/bin/f77
    % setenv FFLAGS "-O -erroff=WDECL_LOCAL_NOTUSED"
    % setenv CXX /opt/SUNWspro/bin/CC
    % ./configure >&! configure.log

More information on environment variables can be found in the manual page for your shell (e.g. "man csh", "man ksh").

Reporting Problems

If you have a problem with the installation and wish to report it, then please do the following:

  1. Read this INSTALL document -- especially the examples and commentary relevant to your system.
  2. Go to the top-level netCDF source directory, src/ (the directory containing the VERSION file).
  3. Execute the command "make distclean". Don't worry if it fails.
  4. Remove the file "config.cache" if it exists.
  5. Set your environment variables as described above.
  6. Re-execute the configure script. Redirect its standard output and standard error to the file "configure.log". If this step fails -- which is indicated by error messages (not warnings) in "configure.log" (not "config.log") -- then stop and send items A through E below to <support@unidata.ucar.edu>.
  7. Execute the command "make". Redirect its standard output and standard error to the file "make.log". If this step fails, then stop and send items A through F below to <support@unidata.ucar.edu>.
  8. Execute the command "make test". Redirect its standard output and standard error to the file "test.log". If this step fails, then stop and send items A through G below to <support@unidata.ucar.edu>.
  9. Execute the command "make install". Redirect its standard output and standard error to the file "install.log". If this step fails, then stop and send items A through H below to <support@unidata.ucar.edu>.

The following items help us diagnose installation problems. PLEASE SEND THEM AS INCLUDED PLAIN TEXT IN YOUR EMAIL AND NOT AS ATTACHMENTS.

  1. The standard output of the command "uname -a".
  2. The contents of the file VERSION, which is in the top-level source directory.
  3. The absolute pathnames of all compilers (C, Fortran, C++) used in the build process (use the type(1) or which(1) utility to determine this).
  4. The file "configure.log" from step 6 above.
  5. The file "config.log", which is created in the top-level source directory by the configure script during step 6 above.
  6. The file "make.log" from step 7 above.
  7. The file "test.log" from step 8 above.
  8. The file "install.log" from step 9 above.