Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Other Builds of the netCDF Package

This is where we document some reported builds of recent releases in environments that we did not or could not try.

Version 4.0.1 (March 2009)

Version 3.6.3 (June 2008)

Version 3.6.2 (March 2007)

Version 3.6.1 (February 2006)

Version 3.6.1-beta2 (January 2005)

Version 3.6.1-beta1 (January 2005)

Version 3.6.0 (December 2004) and 3.6.0-p1 (February 2005)

Version 3.6.0-beta6 (October 2004)

Version 3.5.1 (February 2004)

Version 3.5.1-beta13 (August 2003)

Version 3.5.1-beta12 (August 2003)

Version 3.5.1-beta10 (December 2002)

Version 3.5.0 (March 2001)

Version 3.5beta (February 2001)

Version 3.4 (March 1998)

Version 3.3.1 (June 1997)


Building with Portland Group C++ Compiler

User Tim Hoar reports:

  I worked with a sysadmin here to uncover the following:

./configure CPP="pgcc -E" CC=pgcc CXXCPP="pgcpp -E" CXX=pgcpp \
F77=pgf77 FC=pgf90 F90=pgf90 \
CPPFLAGS="-DNDEBUG -DpgiFortran" \
LDFLAGS="-fPIC" --prefix=${PREFIX}

The PG C preprocessor is invoked by using the '-E' flag in conjunction
with the C compiler ...

64-bit x86_64-redhat-linux-gnu) with Intel icc/ifort 11.0 compilers

User Craig Mattocks reports:

 New versions of the Intel compilers, new flags...

Build netCDF 3.6.3 on (64-bit x86_64-redhat-linux-gnu) with Intel
icc/ifort 11.0 compilers:

setenv CPP 'icc -E'
setenv CXXCPP 'icpc -E'
setenv CC icc
setenv CXX icpc
setenv CPPFLAGS '-DNDEBUG -DpgiFortran'
setenv CFLAGS'-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'
setenv CXXFLAGS'-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'
setenv FC ifort
setenv F77 ifort
setenv F90 ifort
setenv FFLAGS'-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'
setenv AR xiar
setenv LD ifort
setenv LDFLAGS '-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'

All tests passed.

Note: This web site is temporarily out-of-date:

http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers/

Hopefully, others will find this information useful.

64-bit Mac OS X Leopard 10.5.6 Darwin Kernel Version 9.6.0 with Intel icc/ifort 11.1 compilers

User Craig Mattocks reports:

 New versions of the Intel compilers, new flags...

Build netCDF 3.6.3 on (64-bit Mac OS X Leopard 10.5.6 Darwin Kernel
Version 9.6.0) with Intel icc/ifort 11.1 compilers:

setenv CPP "cpp -C -P -xassembler-with-cpp -traditional"
setenv CC icc
setenv CXX icpc
setenv CPPFLAGS '-O3 -DNDEBUG -DpgiFortran'
setenv CFLAGS '-O3 -xT -ip -no-prec-div -no-multibyte-chars -m64 -w'
setenv CXXFLAGS '-O3 -xT -ip -no-prec-div -no-multibyte-chars -m64 -w'
setenv F77 ifort
setenv F90 ifort
setenv F95 ifort
setenv FCFLAGS '-O3 -xT -ip -no-prec-div -no-multibyte-chars -m64 -w'
setenv FFLAGS '-O3 -xT -ip -no-prec-div -no-multibyte-chars -m64 -w'
setenv AR xiar
setenv LD ifort
setenv LDFLAGS '-O3 -xT -ip -no-multibyte-chars -m64'

All tests passed.

Note: This web site is temporarily out-of-date:

http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers/

Hopefully, others will find this information useful.

Mac OS X 10.5 with NAG f95 Fortran

Bjorn Stevens has contributed some updates to Eric Salathé's instructions for building on Mac OS X using the NAG f95 compiler, which described problems and provided a workaround. To quote Stevens:

... This is compounded by some special needs in my case, in that I use byte designator for the kind statement with NAG (in my programs) and I usually build with the -r8 promotion. After much fiddling this set of options appears to work:


setenv FC /usr/bin/f95
setenv FFLAGS '-O2 -dusty -w -kind=byte -r8'
setenv FCFLAGS '-O2 -w=unused -kind=byte -r8'
setenv CPPFLAGS -DNAGf90Fortran

Note the special compiler options "-kind=byte -r8" are special to my interface, as I include the netcdf in a program which makes use of these options. Most other people will not need this. Basically -kind=byte tells the compiler to differentiate 4 and 8 byte reals by the numbers 4 and 8 (which is common in other compilers) rather than 1 and 2 which is its default, -r8 promotes reals to 8 bytes.

Some other observations: setting FCFLAGS and FC appears sufficient to get an F90 implementation, i.e., it does not appear to be necessary to set F90FLAGS and F90 as would be indicated by the web page.

Mac OS X 10.4 Universal Binary

Ryan Cabell has compiled and made available a 4-architecture build of NetCDF 3.6.2 (32- and 64-bit versions of PPC and x86), including Fortran interfaces using gfortran.

Mac OS X 10.5 with Absoft Pro Fortran

Thomas Schrøder reports that the following environment variable settings work for netCDF-3.6.2 with Mac OS X 10.5.1 on an Intel Core Duo using Absoft Pro Fortran 10.0 x86-32 OSX:

PATH=/usr/local/bin
FC=/Applications/Absoft10/bin/f90
F90=/Applications/Absoft10/bin/f90
CC=/usr/bin/gcc
CFLAGS=-DAbsoftProFortran
CXXFLAGS=-DAbsoftProFortran
CXX=/usr/bin/c++
CPPFLAGS=-DAbsoftProFortran

A separate Fortran library was built with

./configure --enable-separate-fortran

To compile an application, use something like

f95 AppName.f95 -o AppName -p /usr/local/include/netcdf.mod -lnetcdff -lnetcdf -O3 -lU77

Mac OS 10.4 and 10.5, with Intel 10 Fortran

Intel provides detailed instructions for building and installing on Mac OS X systems in the document Building NetCDF* with the Intel® compilers.

Andy Hogg reports that the following settings work on an Intel core 2 duo Macintosh running OS X v 10.4.10. with Intel compilers (icc and ifort, v10), which have support for 64-bit architecture:

% setenv CC icc
% setenv FFLAGS -m64 -xT
% ./configure --prefix=/opt/intel/netcdf-3.6.2/ --disable-cxx
% make check
(Note that users who want to build on this platform must get the netCDF-3.6.2 snapshot distribution due to a v2 API bug in the 3.6.2 distribution.

Tim Brücher reports success with the following settings for MacOS X 10.5 with Intel ifort 10.1 using a snapshot distribution later than netCDF-3.6.2:

setenv CC icc
setenv CXX icpc
setenv CFLAGS '-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'
setenv CXXFLAGS '-O3 -xT -ip -no-prec-div -static'
setenv F77 ifort
setenv FFLAGS '-O3 -xT -ip -no-prec-div -static'
setenv CPP 'icc -E'
setenv CXXCPP 'icpc -E'
setenv AR xiar
setenv LD ifort
setenv LDFLAGS '-O3 -xT -ip  -no-prec-div -static'
setenv LANG 'C'
setenv LC_CTYPE 'C'
setenv LC_ALL "C"

To get around a locale problem with multibyte characters in running the configure script, Tim found it was necessary to build as root.


Linux, with Intel 10.1 Fortran compiler

Intel provides detailed instructions for building and installing on Linux systems in the document Building NetCDF* with the Intel® compilers.

Michael Bane reports the following environment settings work for him:

export CC=icc
export FC=ifort
export F90=ifort
export CXX=icpc
export PROCESSFLAGS=-DpgiFortran
export CPPFLAGS="-DpgiFortran"
export FFLAGS="-mp -w "
export CFLAGS="-mp -w "
export F90FLAGS="-mp -w "
export LDFLAGS=

David Mansbach reports successful installation of netCDF 3.6.2 (without the C++ interface):

... on a Redhat Linux System with 8 Xeon processors and ifort and icc
compilers (including C and Fortran APIs successfully) with the
following environment settings:

setenv PATH /opt/intel/cc/10.1.015/bin:${PATH}
setenv PATH /opt/intel/fc/10.1.015/bin:${PATH}

setenv LD_LIBRARY_PATH /opt/intel/cc/10.1.015/lib
setenv LD_LIBRARY_PATH /opt/intel/fc/10.1.015/lib:${LD_LIBRARY_PATH}
setenv NLSPATH /opt/intel/cc/10.1.015/lib/locale/en_US
setenv NLSPATH /opt/intel/fc/10.1.015/lib/locale/en_US:${NLSPATH}
setenv MANPATH /opt/intel/cc/10.1.015/man:`manpath`
setenv MANPATH /opt/intel/fc/10.1.015/man:${MANPATH}
setenv INTEL_LICENSE_FILE "/opt/intel/cc/10.1.015/licenses:/opt/intel/licenses:${HOME}/intel/licenses:/Users/Shared/Library/Application Support/Intel/Licenses"
setenv INTEL_LICENSE_FILE "/opt/intel/fc/10.1.015/licenses:/opt/intel/licenses:${HOME}/intel/licenses:/Users/Shared/Library/Application Support/Intel/Licenses:${INTEL_LICENSE_FILE}"

setenv CC icc
setenv FC ifort
setenv F90 ifort
setenv F77 ifort
setenv CPPFLAGS -DpgiFortran
setenv CXX ''

setenv CFLAGS '-O3 -xT -ip -no-prec-div -static -no-multibyte-chars'
setenv FFLAGS '-O3 -xT -ip -no-prec-div -static'


Linux, with Intel 9.0 Fortran compiler

Arnold Doray reports the following settings work on Linux (Fedora Core 4), on a 32 bit Intel machine, with the Intel fortran compiler (ifort), version 9.0:

CPPFLAGS="-fPIC -DpgiFortran"
FFLAGS='-i-static'

Malte Thoma reports that LC_ALL=C must also be set.


64-bit Build on Linux/IBM POWER5 processors

User Vallard reports:

I compiled netcdf in my environment as follows:

Environment
- IBM POWER5 processors
- Linux (SLES 9 in this case, but should be similar if not the same
for others)
- compilers: IBM Compilers: xlf, xlc, etc

Compilation Script:

#!/bin/bash
LOG=makelog.$$
export CC=xlc_r
export CXX=xlC_r
export FC=xlf_r
export F90=xlf90_r
export CFLAGS="-q64 -O -qmaxmem=-1 -qarch=auto"
export CXXFLAGS="-q64 -O -qmaxmem=-1 -qarch=auto"
export CPPFLAGS="-D_LARGE_FILES -DNDEBUG -Df2cFortran"
export FFLAGS="-q64 -O -qmaxmem=-1 -qarch=auto"
export F90FLAGS="-q64 -qmaxmem=-1 -qarch=auto -qsuffix=f=f90"
./configure --prefix=/usr/local/netcdf64/64 2>&1 | tee $LOG
make 2>&1 | tee -a $LOG
make install 2>&1 | tee -a $LOG

Hope that helps other people.


Building the F90 API for Windows

A user describes how to build the F90 API with compaq fortran, here.


AIX, xlf compiler, -qextname option

Anne Fouilloux reports the following settings work on AIX with xlf and xlf90 compilers for building netCDF version 3.6.2 if the "-qextname" option must be used for compatibility with other libraries:

  ./configure --enable-f90 --prefix=/where/ever F77=xlf_r \
    FC=xlf90_r FCFLAGS='-qsuffix=f=f90 -qextname'  FFLAGS=-qextname \
    CPPFLAGS='-DIBMR2Fortran -Dextname' F90FLAGS="-qsuffix=f=f90"
  make
  make check
  make install


Mac OS X with g95 Fortran compiler

Yi Wang (PNNL) reports success building netCDF version 3.6.2 on Mac OS X with g95:

G95 built netCDF 3.6.2 is a success on my Mac Pro (Intel-Mac OS X 10.4.9).

I have compiled and installed netCDF 3.6.2 with g95 on my Mac Pro Desktop (Intel CPU). Of course, you need to upgrade your Xcode Tools from Apple Developer Site.

My g95 sits in /sw/bin, installed through "fink install g95". You also need "odcctools590" from fink install.

I just

   export FC=g95 F90=g95
   export PATH=/sw/bin:/bin:/usr/bin:/usr/local/bin
   ./configure && make check
   sudo make install


OS-X, xlf compiler

Mike Bauer reports that he has successfully installed netcdf with all APIs including full f90 support on os-x 10.4.6 using xlf 8.1 and netcdf-3.6.1.

export CC=/usr/bin/cc
export CPPFLAGS=-DIBMR2Fortran
export FC=xlf
export F90=xlf90
export F90FLAGS=-qsuffix=cpp=f90

sudo ./configure --prefix=/usr/local

sudo make
sudo make test
sudo make install
sudo make clean

NOTE: It is not necessary to use sudo for any of the above, except "make install".



Linux, Portland Group version 6 compilers

For netCDF version 3.6.1, Jason Elsom reports that he needed to use -mcmodel=medium flags when compiling a netCDF client program with pgf90 for a 64-bit target platform using version 6 PGI compilers, in order to access more than 2 GB of memory. In addition, he compiled the netCDF library with -fpic -Mlarge_arrays "to avoid an inconsistent addressing problem". Here are the specific environment variables he used to build the netCDF libraries:

CC		= pgcc
CXX		= pgCC
FC		= pgf90
F90		= pgf90
CFLAGS		= -O2 -Msignextend -fpic -Mlarge_arrays
CXXFLAGS	= -fpic -Mlarge_arrays
FFLAGS		= -O2 -w  -fpic -Mlarge_arrays
F90FLAGS	= -O2 -w -fpic -Mlarge_arrays


OS-X, g95 compiler

For netCDF version 3.6.1, Tim Hume reports success building on MacOS X 10.4 (Tiger) on a PowerBook G4 with a g95 Fortran compiler, using XCode version 2.4 from Apple and "a fairly recent version" of g95.

In a shell:

export CC=gcc
export CXX=g++
export FC=/Users/tim/bin/g95         # (The path to g95)
export F90=/Users/tim/bin/g95
export CFLAGS='-O2'
export CXXFLAGS='-O2'
export FFLAGS='-O2'
export CPPFLAGS='-DNDEBUG -Df2cFortran'
export LIBS='-lSystemStubs'          # I think this is the critical thing.
./configure --prefix=/Users/tim
make
make test
make install

The fortran tests compile with lots warning messages which look similar to this:

Inconsistent types (REAL(8)/REAL(4)) in actual argument lists at (1) and (2)
In file ftest.F:1383
However, once the test code is run, it seems OK. The -lSystemStubs will always be required when you want to use the Fortran90 NetCDF interface.



Linux 64-bit with NagWare f95

Xianglei Huang reports that netCDF 3.6.1 builds successfully on an HP x9300 64bit-AMD-Operton workstation with NagWare f95 and Linux using

   CC=cc CPPFLAGS="-DNDEBUG -DNAGf90Fortran" CFLAGS="-O3" CXXFLAGS="" \
   FC=f95 FFLAGS="-O3 -dusty -DNAGf90Fortran -ieee=full" \
   FLIBS='' configure --prefix=your_install_directory



Borland Builder C++

Jacek Dlugosz reports how to build the netCDF library under the Borland Builder environment:

You need two objects:

Then you should copy files from netcdf-3.6.1-win32.zip (except netcdf.lib) this way when an instruction is describing it. http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/

You now have to create the import library compatible with the Borland standard. You need the netcdf.dll file in this purpose. To obtain correct library you shoud execute following commands from the command line:

  impdef -a netcdf.def netcdf.dll
  implib -a netcdf.lib netcdf.def

you now have a Borland compatible netcdf.lib file.

The last thing to do is copying files into the adequate place:

  netcdf.h -->> Borland\CBuilderX\include
  netcdf.lib -->> Borland\CBuilderX\lib

that's all - now you can use netcdf library using #include directive.



ifort 9.0/10.0 on Windows

User YAN Haoming contributes:

I had compiled NetCDF3.6.1 Beta version in Win32 and rewrite the
netcdf.inc file. This NetCDF lib and dll file with new netcdf.inc can
be used for both Intel Visual Fortran 9.* and 10.*, and Comparq Visual
Fortran 6.5, 6.6. I hope this maybe help to someone who want to use
NetCDF in Win32.

The precompiled files can be download from
http://yhmyhm.googlepages.com/FORTRAN.htm or directly download the
file
http://yhmyhm.googlepages.com/NetCDF3.6.1Beta1.Win32.for.CVF.IVF.rar

Dr. Guntram Seiss has also built and packaged netCDF 3.6.1 using the Intel-Fortran Compiler and MS Visual C for use with INTEL Fortran 90. The contributed zip-archive is available here. He writes:

The package contains:

The static F77/C-library netcdfs.lib
The netcdf.dll with import library netcdf.lib
The static netcdf_f90.lib for FORTRAN90/95-Interface.
The utilities ncdump and ncgen (dynamic version)
The include and module files (Intel Fortran)

All compilers have been used with the standard options, so i hope that
the libraries can be helpful for most people who use INTEL Fortran on
Windows. 


  • CMake Configuration
  • CMake Configuration

    User Nicholas Yue contributes:

    [Below] is a prototype CMake configuration file which builds both
    libraries (C C++), ncgen and ncdump.
    
    This has been tested on Ubuntu with CMake 2.4.7 using netCDF 3.6.1 as
    a code base.
    
    IMPORTANT : I have coded up the configuration file to build from a
    subdirectory of "src" so that I can monitor what files/directories
    were created.
    
    I have problem on Windows not because of CMake but the definition of
    64bit constants/offset (I have had a look at the customized config.h
    but that did not help). It's in the file ncx.c around line 1776.
    
    Have a look at the cmake configuration and let me know what you think:
    
    PROJECT ( NetCDF )
    
    INCLUDE_DIRECTORIES ( ../libsrc .. )
    ADD_DEFINITIONS ( -DVERSION=3.6.1 -Df2cFortran )
    
    IF (WIN32)
    ADD_DEFINITIONS ( -DVISUAL_CPLUSPLUS )
    ELSE (WIN32)
    ENDIF (WIN32)
    
    ADD_LIBRARY ( netcdf STATIC ../libsrc/attr.c ../libsrc/dim.c
    ../libsrc/error.c ../libsrc/libvers.c ../libsrc/nc.c ../libsrc/ncio.c
    ../libsrc/ncx.c ../libsrc/putget.c ../libsrc/string.c
    ../libsrc/v1hpg.c ../libsrc/v2i.c ../libsrc/var.c)
    
    ADD_LIBRARY ( netcdf_cxx STATIC ../cxx/netcdf.cpp ../cxx/ncvalues.cpp
    )
    
    ADD_EXECUTABLE ( ncgen ../ncgen/main.c ../ncgen/load.c
    ../ncgen/ncgentab.c ../ncgen/escapes.c ../ncgen/getfill.c
    ../ncgen/init.c ../ncgen/genlib.c )
    TARGET_LINK_LIBRARIES ( ncgen netcdf )
    
    ADD_EXECUTABLE ( ncdump ../ncdump/ncdump.c ../ncdump/vardata.c
    ../ncdump/dumplib.c )
    TARGET_LINK_LIBRARIES ( ncdump netcdf )
    
    
    


    ifort 9.0 on Linux

    User Gab Abramowitz contributes:

    Just in case you want another set of build flags that worked (you
    have nothing under linux, ifort and 3.6.1 (), and
    none of the others seemed to work for me):
    
    Fedora Core4, x86, using Intel 9.0 Fortran compiler:
    
    export FC='ifort'
    export F90='ifort'
    export FFLAGS='-i-static -mp'
    export CPPFLAGS='-fPIC -DpgiFortran'
    make
    make test
    make install
    


    NEC-SX

    Stephen Leak (NEC) has

    ... collected together a few patches that may be of more general interest. These were originally made with the NEC-SX in mind, but are more general than that (we have also tested and used them on x86, ia64 and HP machines).

    The most important fixes a bug in libsrc/v2i.c which affects machines whose SIZEOF_SIZE_T != SIZEOF_LONG. If it is not too late it's probably a good idea to get this one into v3.6.2 (NOTE: This patch in included in v3.6.2, and is available in the latest 3.6.2 beta: latest 3.6.2 beta release.

    The other patches are against netcdf-3.6.1 and are independent of each other. An explanation of each [and links to download the patches are] available here.

    (to use them: patch -p0 < xxxx-patch in src/ directory).



    HPUX with NagWare f95 compiler

    Axel von Engeln reports that the following settings were necessary to compile netCDF on HPUX with NAG fortran:

    CC=cc CPPFLAGS="-DNDEBUG -DNAGf90Fortran" CFLAGS="-O3" CXXFLAGS="" \
       FC=f95 FFLAGS="-O3 -dusty  -DNAGf90Fortran -ieee=full" \
       FLIBS='' configure --prefix=yourdirhere
    



    Compiling CXX API on Irix with MIPSpro compiler

    Atro Tossavainen reports that CXXFLAGS="-LANG:std" is required for version 7.3 of the MIPSpro CC compiler (for the C++ API).



    Xeon Multithreaded processor, using CentOS, and Intel Fortran

    User Gregory C Smith reports:

    We want to report successful compilation of Netcdf 3.6.0-p1 libraries
    on a Xeon Multithreaded processor, using CentOS, and Intel Fortran
    Compiler 9.0, 64bits. The environment variables are:
    
    FC=ifort
    F90=ifort
    CC=gcc
    CXX=g++
    FFLAGS="-O"
    CPPFLAGS="-DNDEBUG -DpgiFortran"
    



    Building with Lahey Fortran 4.50i on Windows

    Evan Twombly suggests the following for building with Lahey Fortran:

    
    Caveat: I am compiling with version 4.50i.  This may work differently
    with newer versions.
    
    I access the netCDF DLL Library.  I did not access the NF90
    subroutines, I went directly to the NF_ routines.  Here are the key
    issues you need to know:
    
    1) The netCDF library is compiled with UPPER CASE routines, or at
    least that is how it appears to the Lahey Library Manager. Lahey
    Fortran defaults to converting everything to lower case. So you need
    to turn on the flag that requires the compilation of code to respect
    the case of what you have typed.  Warning: this means your routines
    and variables are case sensitive!  ie -twocase in your local lf90.fig
    file or on the command line.
    
    2) You need to compile the program as a windows program, even if you
    are not using any windows code to access DLLs.  To see your screen
    output, you need to put a pause at the end of the program so the DOS
    window that opens does not close at the end of the run.  ie -win in
    your local lf90.fig file or on the command line
    
    3) When you refer to a netCDF DLL Routine, you need to identify it as
    DLL with the DLL_IMPORT line or you can add the DLL_IMPORT lines to
    the netcdf.inc file.
    
    4) Whenever a character string is sent to an NF_ routine you must send
    an array of bytes and the string length.  The string length should be
    send as a number, NOT a pointer. This is done using Lahey's carg
    extension. (C Argument) The string you are sending should be NULL
    terminated.  Strings you receive should have the NULL character
    removed.
    
         ie To SEND a name to an NF Routine
    
         include 'netcdf.inc'
         CHARACTER(*)       :: cName
         CHARACTER(MAXCHAR) :: cString
         INTEGER(1)         :: iString(MAXCHAR)
         CHARACTER(7)       :: cMaxChar='(128a1)'
         DLL_IMPORT         :: NF_INQ_VARID
         ...
         cString=trim(cName)//char(0)
         read(cString,cMaxChar)iString
         iStatus = NF_INQ_VARID(lu_netCDF, iString, carg(MaxChar), iVarID)
    
         ie To GET a name from an NF Routine
    
         include 'netcdf.inc'
         CHARACTER(*)       :: cName
         CHARACTER(MAXCHAR) :: cString
         INTEGER(1)         :: iString(MAXCHAR)
         CHARACTER(7)       :: cMaxChar='(128a1)'
         DLL_IMPORT         :: NF_INQ_DIM
         ...
         iStatus = NF_INQ_DIM(lu_netCDF, iDimNumber, iString,
         carg(MaxChar),
    iDimLength)
         do i=1,MaxChar
           if(iString(i)>0)cycle
           iString(i:)=32
         enddo
         write(cString,cMaxChar)iString
         cName=cString
    
    I had a very limited need for access to the DLL so I did what was
    described above.
    What might work in general is
      1) convert all of the src/f90 subdirectory files to upper case
      2) convert all of netcdf.inc to upper case
      3) make a copy of netcdf_externals.f90 and change INTEGER,EXTERNAL
         to DLL_IMPORT and add this to netcdf.inc
      4)  ... (change the CHARACTER(LEN=80),EXTERNAL to DLL_IMPORT also)
          Then try compiling that along with the flags -win and -twocase
    
    Option:
      If you JUST change the NF_ routines to upper case above and leave
    everything else lower case, then compile an interface module using the
    -twocase flag, you may be able to remove it for all other programming.
    
    



    Compiling with gfortran

    Magnus Hagdorn reports success compiling and running the tests of netCDF 3.6.0-p1 on

    uname -a
    Linux gargel 2.6.10-5-k7 #1 Tue Jun 7 10:08:19 UTC 2005 i686 GNU/Linux
    
    with the gfortran compiler from gcc version 4.1.0 20050624 (experimental) by setting the following flags:
    F90FLAGS=-ff2c 
    FFLAGS=-ff2c
    



    NEC SX architectures, including the Earth Simulator

    Takashi Kagimoto of the Frontier Research Center for Global Change/JAMSTEC has contributed a patch of netcdf-3.6.0-p1 for the NEC SX series that includes changes to optimally vectorize type transformations on NEC SX architectures. Here are his notes on using the patch:

      I attached a patch file in order to make it feasible
    to easily build netCDF library on NEC SX architectures
    (SX-4,5,6,7 or 8) including the Earth Simulator (ES). 
    What I changed from the original is as follows,
    
      (1) config.guess supports SX-7, -8 and ES architecture
        (but I checked only on SX-5, -8 and ES),
      (2) LINK.F, LINK.f and LINK.F90 macros in macros.make
        is determined in configure script so that an appropriate
        link process is done if c++ compiler is used for 
        compilation of C language source code on NEC 
        architectures (as you may know, c++ must be used for
        linking object and library in that case),
      (3) typeSizes.f90 and netcdf_overloads.f90 have cpp
        switches to plug-off unnecessary parts on NEC machines,
      (4) test carried out in ncgen directory allows a trivial
        failure associated with precision of floating point
        values
    
    Additionally I changed libsrc/ncx.m4 in such a way that
    type transformation routines are optimally vectorized
    on NEC SX architectures. Originally this modification is
    proposed by a person working in Max-Planck Institute.
    He has vectorized only put and get routines for float to 
    double and double to float transformations. I applied the
    same modification to any variable types such as
    
        int            int
        long           long
        float   <--->  float
        double         double
    
    all of which are objects for the vectorization. This modification
    can be used if you build netcdf library on SX (if defined
    _SX macro), thus it does not affect installation of the
    netCDF library on other architectures at all.
    
      How I built the netCDF on NEC architectures is as follows,
    
    [SX-5]
      % setenv CC cc
      % setenv FC 'f90 -dW'
      % setenv F90 'f90 -dW'
      % setenv TEMP_LARGE /work
      % cd netcdf-3.6.0-p1/src
      % patch -p0 < netcdf-3.6.0-p1-NEC-patch
      % ./configure
      % make
      % make test
      % make extra_test
      % make install
    
    [SX-8]
      % setenv CC c++
      % setenv FC 'f90 -dW'
      % setenv F90 'f90 -dW'
      % setenv TEMP_LARGE /work
      % cd netcdf-3.6.0-p1/src
      % patch -p0 < netcdf-3.6.0-p1-NEC-patch
      % ./configure
      % make
      % make test
      % make extra_test
      % make install
    
    [ES]
      % setenv CC 'cc -D_SX'
      % setenv FC 'f90 -dW -D__SX__'
      % setenv F90 'f90 -dW  -D__SX__'
      % setenv TEMP_LARGE /work
      % cd netcdf-3.6.0-p1/src
      % patch -p0 < netcdf-3.6.0-p1-NEC-patch
      % ./configure
      % make
      % make test
      % make extra_test
      % make install
    



    netcdf.dll and Visual Basic V6

    Carsten Wieczorrek developed code in VB 6 to export chromatographic data into the netcdf/ANDI format. The application writes netCDF files that can be read by CHROMELEON, for example. For others interested in programming with netcdf.dll from VB 6, see Wieczorrek's web page on netCDF and VB 6.0 and for VB.net, see netCDF and VB.net.



    OpenVMS Alpha for netCDF 3.6.1-beta2

    Jouk Jansen compiled and tested NetCDF 3.6.1-beta2 successfully on an OpenVMS Alpha system. Details are available at http://nchrem.tnw.tudelft.nl/openvms/software2.html#NETCDF. The C++ interface was not built since the current C++ compiler for OpenVMS does not support the required namespace syntax.



    Linux x86 with Intel ifort 8.1 fortran compiler

    See the successful build output for an example of building and passing tests with the ifort compiler.

    Contributed by Arnaud Desitter.

    env \
     FC="ifort" \
     FFLAGS="-g -O2 -mp -recursive"\
     CPPFLAGS="-DNDEBUG -DpgiFortran" \
     CC=gcc \
     CXX=g++ \
     CFLAGS="-g -O2 -march=pentium3" \
     ./configure --prefix=/path/to/installdir
    

    Richard P. Signell reports that the environment settings above did not work for him, but these did:

    export FC=ifort
    export F90=ifort
    export FFLAGS="-O -mp"
    export CPPFLAGS="-DNDEBUG -DpgiFortran"
    

    Linux x86 with Intel ifc 7.1 fortran compiler

    Contributed by Arnaud Desitter.

    env \
     FC="ifc" \
     FFLAGS="-g -O -mp -w" \
     FLIBS="-Vaxlib" \
     CPPFLAGS="-DNDEBUG -DpgiFortran" \
     CC=gcc \
     CXX=g++ \
     CFLAGS="-g -O2 -march=pentium3" \
     ./configure --prefix=/path/to/installdir
    
    


    Linux x86 with NagWare f95 5.0 compiler

    Contributed by Arnaud Desitter.

    env \
     FC="f95" \
     FFLAGS="-g -mismatch -w=unused -DNAGf90Fortran -ieee=full"\
     CPPFLAGS="-DNDEBUG -DNAGf90Fortran" \
     CC=gcc \
     CXX=g++ \
     CFLAGS="-O2 -march=pentium3 -g" \
     ./configure --prefix=/path/to/installdir
    


    SGI Altix (Itanium2) using Intel compilers

    Len Makin determined a combination of environment variable settings that works with SGI Altix (Itanium2) running redhat-release-3AS-2 Linux 2.4.21-sgi303r2 using Intel compilers:

    env CPPFLAGS="-DNDEBUG -DpgiFortran" \
    CC=icc \
    CFLAGS="-O -mp" \
    CXX=icpc \
    CXXFLAGS="-O -mp -cxxlib-gcc" \
    FC=ifort \
    FFLAGS="-O -mp -integer_size 32 -real_size 32 -double_size 64" \
    ./configure
    

    Gerardo Cisneros contributed a different way of supporting Intel compilers for SGI Altix systems. It uses this patch to src/fortran/cfortran.h to add configuration for the Intel compilers. After applying the patch, set the following environment variables before running './configure':

    CC=icc
    FC=ifort
    CXX=icc
    CFLAGS='-g -O2 -w'
    CXXFLAGS='-g -O2'
    FFLAGS='-g -O2 -mp -w'
    F90FLAGS='-g -O2 -mp -w'
    
    This was tested with ifort 9.0.015 and icc 9.0.016 compilers, but these settings should also work with the 8.1.x compilers.


    g95 Fortran on x86 Linux

    Reported by Charlie Zender:

    The following switches work for to build netCDF 3.6+ on x86 with the
    g95 
    fortran compiler:
    
    export CC='gcc'
    export CXX='g++'
    export CPPFLAGS='-DNDEBUG -DpgiFortran'
    export CFLAGS='-O -g'
    export FC='g95'
    export F90='g95'
    export FFLAGS='-O -g -fno-second-underscore'
    export F90FLAGS='-O -g -fno-second-underscore'
    
    while the following switches work for me on x86_64:
    
    export CC='gcc'
    export CXX='g++'
    export CPPFLAGS='-DNDEBUG -DpgiFortran'
    export CFLAGS='-O -fPIC -m64'
    export FC='g95'
    export F90='g95'
    export FFLAGS='-O -g -fno-second-underscore'
    export F90FLAGS='-O -g -fno-second-underscore'
    


    Absoft Fortran on Mac OS X

    For this to work, you must use the 3.6.1 beta release (3.6.1-beta2 or later). With that release, the following works:

    env CPPFLAGS="-DAbsoftProFortran" \
    	FLIBS="-lU77" \
    	 ./configure
    

    John Tanski has provided an alternative script for compiling the netCDF source distribution with Absoft 9.2 running under Tiger (10.4.2). He notes:

    One caveat is that the flags used in script must be used in compiling programs accessing the library, especially NOT having the -YEXT_NAMES and -YEXT_SFX options present. Also, I've compiled on a Dual G5 so I could get the 64-bit form of the library. Hope this provides some guidance for others.

    Michael Shopsin has provided another alternative in the form of a couple of scripts and precompiled binaries for MacOS X in a downloadable file macosx-makeNetCDF.zip. The file creates a folder with instructions for its use to install the library and to compile a Fortran-90 program.


    Building the F90 API for Windows for the Intel ifort compiler

    Dr. Haoming YAN reports:

    I had prebuilt the Fortran90 interface successfully for NetCDF3.6.1
    Beta1 version of Win32 for IVF9.* or IVF10.* and CVF6.6.
    
    The prebuilt files (NetCDF3.6.1Beta1.Win32.for.CVF.IVF.rar) can be
    download from one of the below sites:
    
    http://www.whigg.ac.cn/yanhm/fortran.htm
    
    http://yhmyhm.googlepages.com/FORTRAN.htm
    

    Pathscale compiler recommendation from vendor

    Didier Cabannes recommends the following configuration for building netCDF for Pathscale compilers:

      export CC=pathcc
      export FC=pathf90 
      export F90=pathf90
      export CXX=pathCC
      export CFLAGS=-Df2cFortran
      ./configure --prefix=/home/ssp/netcdf_path
      make
      make test
      make install
    

    Pathscale compilers on Beowulf cluster

    John Evans determined a combination of environment variable settings that works with Pathscale compilers on a Beowulf cluster:

    env CC=pathcc \
    	CFLAGS="-DpgiFortran" \
    	FC=pathf90 \
    	FFLAGS="-cpp -DpgiFortran -fno-second-underscore" \
    	F90FLAGS="-cpp -DpgiFortran -fno-second-underscore" \
    	F90=pathf90 \
    	CXX=pathCC \
    	CXXFLAGS="-DpgiFortran" \
    	 ./configure
    


    Intel Fortran (ifort 8.1) on Linux x86

    According to Arnaud Desitter,

    env \
     FC="ifort" \
     FFLAGS="-g -O2 -mp -auto" \
     CPPFLAGS="-DNDEBUG -DpgiFortran" \
     CC=gcc \
     CFLAGS="-O2 -g" \
     ./configure --prefix=/path/to/install
    
    ("-mp" is necessary for "make check" to succeed, "-auto" is not necessary. It allocates local variables on the stack and makes checking more relevant as otherwise all arrays and strings are allocated statically)


    NagWare f95 compiler on Linux x86

    According to Arnaud Desitter,

    env \
     FC="f95" \
     FFLAGS="-g -mismatch -w=unused -DNAGf90Fortran -ieee=full"\
     CPPFLAGS="-DNDEBUG -DNAGf90Fortran" \
     CC=gcc \
     CFLAGS="-O2 -g" \
     ./configure --prefix=/path/to/install
    
    "-ieee=full" is necessary for "make check" to succeed. "-mismatch" is necessary to downgrade argument mismatches from error to warnings (mismatches are in fortran test suite and in f90 library).


    MacOS X with IBM xlf Fortran

    Craig Mattocks has contributed a Mac OS X install script for downloading, uncompressing, configuring, building, testing, and installing netCDF on a MacOS X system using the IBM xlf Fortran compiler.


    PathScale compilers

    Robert Walsh has contributed this patch for the fortran/cfortran.h file in the netCDF 3.5.1 release to make it work with the PathScale compilers. This patch will be incorporated into the 3.6.0 release, so that release should work with PathScale compilers "out of the box".


    AMD Opteron Linux, PGI compiler

    Dr. Constantinos Evangelinos reports the following settings successfully completed the bundled test for NetCDF 3.5.1 on an Opteron system with SuSE Enterprise Server 8, gcc 3.3.1 and PGI compiler V. 5.1-3:

    64bit, PGI F77 & C++ compilers, GCC for C, (pgf90 will not work for F90):

     env CC=gcc CFLAGS="-O3 -funroll-loops -march=k8 -m64 -mfpmath=sse -msse2
     -ffast-math -mcmodel=medium" FC=pgf77 FFLAGS="-fastsse -tp k8-64 -Minline
     -Mvect=recog,transform,assoc,cachesize:1048576 -mcmodel=medium" CXX=pgCC
     CXXFLAGS="-fastsse -tp k8-64 -Minline
     -Mvect=recog,transform,assoc,cachesize:1048576 -mcmodel=medium"
     CPPFLAGS="-DNDEBUG -DpgiFortran -D_FILE_OFFSET_BITS=64
     -D_LARGEFILE_SOURCE" ./configure
    
    This one works but the tests complain:
     ./nf_test: Symbol `exit' causes overflow in R_X86_64_PC32 relocation
     ./nf_test: Symbol `exit' causes overflow in R_X86_64_PC32 relocation
     ./ftest: Symbol `exit' causes overflow in R_X86_64_PC32 relocation
     ./ftest: Symbol `exit' causes overflow in R_X86_64_PC32 relocation
     ./nctst: Symbol `exit' causes overflow in R_X86_64_PC32 relocation
    
    Compiling without -mcmodel=medium does away with these warnings (and should provide a small speedup) at the expense of available address space.

    32bit, PGI F77 & C++ compilers, GCC for C, (pgf90 will not work for F90):

     env CC=gcc CFLAGS="-O2 -funroll-loops -march=k8 -m32 -mfpmath=sse -msse2
     -ffast-math" FC=pgf77 FFLAGS="-fastsse -tp k8-32 -Minline
     -Mvect=recog,transform,assoc,cachesize:1048576" CXX=pgCC
     CXXFLAGS="-fastsse -tp k8-32 -Minline
     -Mvect=recog,transform,assoc,cachesize:1048576" CPPFLAGS="-DNDEBUG
     -DpgiFortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" ./configure
    

    64bit, all GCC, no F90:

     env CC=gcc CFLAGS="-O3 -funroll-loops -march=k8 -m64 -mfpmath=sse -msse2
     -ffast-math -mcmodel=medium" FC=g77 FFLAGS="-O3 -funroll-loops -march=k8
     -m64 -mfpmath=sse -msse2 -ffast-math -mcmodel=medium -Wno-globals" CXX=g++
     CXXFLAGS="-O3 -funroll-loops -march=k8 -m64 -mfpmath=sse -msse2
     -ffast-math -mcmodel=medium" CPPFLAGS="-DNDEBUG -Df2cFortran
     -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" ./configure
    

    32bit, all GCC, no F90:

     env CC=gcc CFLAGS="-O2 -funroll-loops -march=k8 -m32 -mfpmath=sse -msse2
     -ffast-math" FC=g77 FFLAGS="-O2 -funroll-loops -march=k8 -m32 -mfpmath=sse
     -msse2 -ffast-math -Wno-globals" CXX=g++ CXXFLAGS="-O2 -funroll-loops
     -march=k8 -m32 -mfpmath=sse -msse2 -ffast-math" CPPFLAGS="-DNDEBUG
     -Df2cFortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" ./configure
    


    SuSE SLES 8 Opteron Linux, PathScale compiler

    Marc Rieffel reports the following (slightly modified to conform to standard-shell syntax):

    I've been able to build a working version of netcdf-3.5.1 with the PathScale compiler on a SuSE SLES 8 Opteron system using the following command. Note that the "-cpp -DpgiFortran" has to be in the FC definition, not just the FFLAGS definition. The FFLAGS definition isn't used everywhere these flags are needed.

    CC='/opt/pathscale/bin/pathcc -DpgiFortran' \
    FC='/opt/pathscale/bin/pathf90 -cpp -DpgiFortran -fno-second-underscore' \
    F90='/opt/pathscale/bin/pathf90 -DpgiFortran -cpp -fno-second-underscore' \
    CXX='/opt/pathscale/bin/pathCC -DpgiFortran' \
    ./configure
    
    -- Marc Rieffel, Sr. Manager, R&D, Paracel

    Intel ifc Fortran 95 compiler

    Arnaud Desitter successfully built the netCDF package using the Intel Fortran-95 compiler, ifc. The environment variable settings were

    FC=ifc
    FLIBS=-Vaxlib
    FFLAGS="-O -mp -cm -w95"
    CPPFLAGS="-DNDEBUG -DpgiFortran"
    CC=gcc
    
    Arnaud's rationale for the Fortran compiler options is:
    -O
    Enable reasonable optimization.
    -mp
    Maintain floating point accuracy. Necessary so that "make test" succeed.
    -cm -w95
    Suppress all comment messages and messages about use of non standard Fortran. Useful for "make test".
    -Vaxlib
    Link with portability library. Avoids hardwiring the compiler location. Necessary for "make test".
    -DpgiFortran
    Portland Group compiler has the same default calling conventions.


    32-bit Linux Opteron using ifort(1)

    Christoph Arns successfully built a 32-bit netCDF package on an AMD Opteron system running Linux Fedora Core 1 using the ifort(1) compiler:

    I would like to report a successful build including make test for the
    following platform:
    
    AMD Opteron Fedora Linux, ifort compiler (32-bit installation):
    
    setenv FC  ifort;
    setenv F90 ifort;
    setenv FLIBS -Vaxlib;
    setenv FFLAGS "-O -mp -static-libcxa";
    setenv CPPFLAGS "-DNDEBUG -DpgiFortran";
    setenv CC gcc;
    setenv CFLAGS "-O2 -funroll-loops -m32 -mfpmath=sse -msse2 -ffast-math";
    setenv CXX g++;
    setenv CXXFLAGS "-O2 -funroll-loops -m32 -mfpmath=sse -msse2 -ffast-math";
    setenv FFLAGS "-O -mp -cm -w95 -static-libcxa -Wl,-m elf_i386";
    setenv F90FLAGS "-O -mp -cm -w95 -static-libcxa -Wl,-m elf_i386";
    


    Intel Fortran Compiler (ifc) 7.1

    Hudson Souza reports that it was necessary to use the "-i_dynamic" option with version 7.1 of the Intel Fortran Compiler (ifc, build 20030307Z) for 32-bit applications in order for the netCDF package to pass its "make test" on an Linux (Redhat 9.0, kernel 2.4.20-8). The environment variable settings he used were:

    FC=/usr/intel/compiler70/ia32/bin/ifc 
    FLIBS=/usr/intel/compiler70/ia32/lib/libPEPCF90.a 
    FFLAGS="-O -mp -cm -i_dynamic -dynamic-libcxa" 
    CPPFLAGS="-DNDEBUG -DpgiFortran" 
    CC=/usr/bin/gcc 
    


    Intel Fortran Compiler (ifc) 8.0

    Jeff Nucciarone reported a successful build and test of the netCDF package on an Itanium based Unisys ES7000 running Linux, kernel version 2.4.21-9.0.3.EL (Red Hat Linux 3.2.3-34) using the following settings:

    FC=/usr/local/intel/intel_fc_80/bin/ifort
    FFLAGS="-O -mp" 
    CPPFLAGS="-DNDEBUG -DpgiFortran" 
    CC=/usr/bin/gcc 
    


    Using Intel ifort for f90 with g77

    David Forrest reports the following environment variable settings work for building netCDF on Linux using Intel's ifort for the Fortran 90 compiler and g77 for the Fortran 77 compiler:

     CPPFLAGS='-DpgiFortran -DNDEBUG'
     FC=g77
     FFLAGS='-fno-second-underscore'
     F90='ifort'
     F90FLAGS='-Vaxlib -mp -static-libcxa'
    

    The above works for a linux install using g77 to build the library and intel's ifort for building the f90 interface. 'make test' works fine, with or without the -mp.

    Crossing fortran compilers is awkward -- the -fno-second-underscore is a big difference between the f2c type compilers like g77 and others, but it makes symbols that non-f2c fortran compilers understand.

    In a mixed linux f2c / f90 environment, it might be useful to produce two libraries, one for the f2c type (nf_open__...) routines and one for the non-f2c routines (nf_open_).

    An alternate solution would be to conditionally rewrite the f90 code to reference the double-underscored fortran routines similar to the .../fortran/ncfortran.h #if defined(f2cFortran) clause.

    I was investigating this because I wanted to use the debian netcdf package, which seems to be missing the fortran interface.



    OpenVMS Alpha

    Jouk Jansen compiled and tested NetCDF 3.5.1 successfully on an OpenVMS Alpha system. Details are available at http://nchrem.tnw.tudelft.nl/openvms/software2.html#NETCDF. The C++ interface was not built since the current C++ compiler for OpenVMS does not support the required namespace syntax.


    Linux 2.4 using g95

    Tom Wainwright successfully built and tested the netCDF 3.5.1 package on an Intel Linux 2.4 (SuSE 8.2) system using the g95(1) Fortran compiler with the following environment variable settings:

    export FC=g95
    export F90=g95
    export CPPFLAGS="-Df2cFortran"
    


    MacOS X 10.2 and NAG f95

    Eric Salathé was successful in building netcdf with all fortran 90 features on Macintosh OS X 10.2 using the NAG f95 compiler. make test runs successfully through all tests.

    Here is what he did:

    1) Define the variables:
    
    setenv FC /usr/local/bin/f95
    setenv FFLAGS "-O -dusty -w"
    setenv F90 /usr/local/bin/f95
    setenv FPP "/usr/local/bin/f95 -fpp"
    setenv F90FLAGS "-O -w=unused -mismatch_all"
    setenv CPPFLAGS "-DNAGf90Fortran"
    
    2) Run configure <--prefix=installationd_directory>
    
    3) OS X is case insensitive, which causes problems with .F files. To 
    work around, modify the .F.o rule in the rules.make file. It should 
    read like this:
    
    # Not all FORTRAN compilers support C-preprocessing of *.F files; ergo, a
    # relatively complicated rule ensues.
    .F.o:
             @case "$(COMPILE.F)" in \
                 '') \
                     set -x; \
                     cp $*.F $*.ff; \
                     $(FPP) $(FPPFLAGS) -c -O -dusty -w $*.ff ;      \
                     ;;      \
                 *)  \
                     set -x; \
                     $(COMPILE.F) $<;        \
                     ;;      \
             esac
    
    4) Add this line to the file nf_test.F in the directory nf_test, after 
    the program nf_test statement:
       USE F90_UNIX_ENV, ONLY : IARGC,GETARG
    (this will define iargc and getenv)
    
    comment out this line:
        integer         iarg
    (conflicts with f90_unix_env)
    
    5) Make and make test
    
    6) make install
    
    7) manually copy src/f90/netcdf.mod src/f90/typesizes.mod to 
    /usr/local/include, or wherever the installation is supposed to go.
    



    FreeBSD 4.8

    Rick Grubin successfully built the netCDF package using the following environment variable settings:

    CC=gcc   # v3.3
    FC=g77   # v3.3
    CXX=g++  # v3.3
    F90=""
    CFLAGS=-O
    FFLAGS=-O
    CXXFLAGS=-O
    CPPFLAGS=-Df2cFortran
    


    Lahey Fortran 95 version 6 compiler

    Gareth Williams reports that compiling with a CPPFLAGS environment variable that includes "-DNAGf90Fortran" works with the Lahey fortran compiler lf95 (version L6.00a) and netcdf-3.5.1-beta10. Presumably this will also work with later versions as well.



    Intel ifc Fortran 95 compiler

    Ayal Anis indicates that the following should work on systems running GENTOO Linux 1.4rc4 for 32-bit applications:

    export FC=/opt/intel/compiler70/ia32/bin/ifc
    export FLIBS="/opt/intel/compiler70/ia32/lib/libPEPCF90.a"
    export FFLAGS="-O -mp -dynamic-libcxa" # -static-libcxa also works
    export CPPFLAGS="-DNDEBUG -DpgiFortran"
    export CC=gcc

    This works because the Fortran-calling-C argument-passing conventions for the Intel Fortran compiler are, apparently, identical to those of the Portland Group Fortran compiler.

    Alternatively, Carlie Coats has provided a patch to "src/fortran/cfortran.h" to make this work with the 3.5.0 release. After applying the patch, add the line

    #define INTEL_COMPILER
    
    to that file. Environment variable settings before running the configure script are:
    FC=ifc
    FLIBS="-L/usr/local/intel/compiler50/ia32/lib -lPEPCF90"
    FFLAGS="-O -mp"
    
    According to Andreas Manschke
    The "-mp" option is for saying ifc should use default numerics and not optimized ones. Without that "make test" runs but detects some differences.

    Enda O'Brien reports that the above changes

    ... apply equally well to the Intel efc compiler (for 64-bit Itanium systems), with just the following entirely predictable changes:
    FC=efc
    FLIBS="-L/usr/local/intel/compiler70/ia64/lib -lPEPCF90"
    FFLAGS="-O -mp"
    
    In particular, the changes to the src/fortran/cfortran.h file for ifc are identical for efc. By the way, I've done this with netcdf-3.5.0. I'm running Linux 2.4.18-e.12smp on a couple of dual-processor HP rx2600s.



    AbSoft Fortran 90 compiler on MacOS X

    According to Dierk Polzin, netCDF 3.5.0 compiles and passes its test suite with Absoft Pro Fortran 7.0 on MacOS X if you follow these steps. First, apply this patch to the src/fortran/cfortran.h file that comes with the netCDF 3.5.0 distribution:

      patch -c cfortran.h absoft90-macosx.patch
    
    Next, set the environment variables as follows before running the configure script that comes with the distribution:
    FC=/Applications/absoft/bin/f90
    FFLAGS="-w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1"
    F90=/Applications/absoft/bin/f90
    F90FLAGS="-w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1"
    FLIBS=-lU77
    CPPFLAGS="-DAbsoftProFortran"
    CFLAGS=
    

    WARNING: The above will cause the Fortran-callable routines in the netCDF library to be in lower-case symbols with trailing underscores; consequently, all packages that use the netCDF library will also have to be compiled using the options "-YEXT_NAMES=LCS -YEXT_SFX=_".



    AbSoft Fortran 90 compiler on Linux

    We received the following email from Bill McKie on installing the netCDF package on a Linux system using the AbSoft Fortran-90 compiler:
    From: Bill McKie <mckie@sky.arc.nasa.gov> 
    Subject: netcdf v3.5.0 build notes for RH Linux & Absoft f90
    Organization: NASA/Ames
    
    Hi 
    
    I recently picked up netcdf v3.5.0 for use on a Redhat Linux v6.1
    system with the AbSoft ProFortran v6 f90 compiler.
    
    It is working ok.  But as with builds of previous versions of netcdf,
    I had to do a few manual customizations in the build process in order
    for it to install on the above system.  I thought you might like to have
    my notes for possible use in helping others with a similar system.
    
    A summary of the steps I used follows.
    
    Thanks for continuing to develop and provide the netcdf package,
    
    Bill McKie
    NASA Ames
    
    
     Unpack the distribution tarball as usual.
    
     Ensure the AbSoft f90 compiler is in the PATH environment variable.
    
     Set the environment variables:
       CC gcc
       FC "f90"
       F90 "f90"
       CXX ""
       CFLAGS ""
       FFLAGS ""
       F90FLAGS ""
       CXXFLAGS ""
    
     cd .../netcdf-3.5.0/src
    
     ./configure --prefix=directory_path_to_install_into
    
     cd fortran
    
     Edit cfortran and add following line near top
    
      #define AbsoftProFortran
    
     cd .../netcdf-3.5.0/src
     make
    
     Don't do "make test", since it will fail at some link
     steps with unsatisfied external references to command
     line argument routines iargc and getarg.
    
     cd .../netcdf-3.5.0/src
     Edit macros.make and change the line:
      NETCDF.MOD = netcdf.mod
     to:
      NETCDF.MOD = NETCDF.mod
    
     make install
    



    Portland Group's pgf90 compiler on Linux

    Subsequent to the release of version 3.5.0 of the netCDF package, we successfully built the package on an in-house Linux system using the Fortran-90 compiler from Portland Group. The type of system was

    $ uname -a
    Linux sunshine 2.4.2-2smp #1 SMP Sun Apr 8 20:21:34 EDT 2001 i686 unknown
    
    The environment variable settings were
    CC=/usr/bin/gcc
    CPPFLAGS='-DNDEBUG -DpgiFortran'
    CFLAGS=-O
    FC=/opt/pgi/linux86/bin/pgf90
    FFLAGS="-O -w"
    CXX=/usr/bin/g++
    

    This information will be in the next release as an example.



    HP-UX B.11.11 9000/800 using /opt/fortran90/bin/f90

    According to a user, the following settings should work. Please report if they don't.

    CPP=/usr/bin/cc -E
    CPPFLAGS=
    CC=/usr/bin/cc
    CXX=
    FC=/opt/fortran90/bin/f90
    FFLAGS=
    F90FLAGS=
    F90LIBS=
    

    Since releasing this version, we've managed to build it in 64-bit mode using the following settings:

    CC=/bin/cc
    CPPFLAGS='-D_HPUX_SOURCE -D_FILE_OFFSET_BITS=64'    # large file support
                                  # might work without it
    CFLAGS=+DD64                  # 64-bit mode
    FC=/opt/fortran90/bin/f90     # Fortran-90 compiler
    FFLAGS='-w +DA2.0W +noppu'    # 64-bit mode, no "_" suffixes
    FLIBS=-lU77
    CXX=                          # C++ doesn't support 64-bit mode
    


    HP-UX ia64 (Itanium 2) using f90

    Charles F. Fisher of the University of Kentucky has successfully built the netCDF 3.5.0 package on an HP-UX ia64 (Itanium 2) system using the following settings:

    32-bit installation

    CC=cc
    CPPFLAGS="-D_HPUX_SOURCE -D_FILE_OFFSET_BITS=64 -Dextname"
    FC=f90
    FFLAGS=-w
    FLIBS=-lU77
    CXX=aCC
    

    64-bit installation

    CC=cc
    CPPFLAGS="-D_HPUX_SOURCE -D_FILE_OFFSET_BITS=64 -Dextname"
    FC=f90
    FFLAGS="-w +DD64"
    FLIBS=-lU77
    CXX=aCC
    CXXFLAGS=+DD64
    


    NEC-SX5 with SUPER-UX

    Anne Fouilloux has provided the following changes needed to compile and install netcdf-3.5.0 on a NEC-SX5 platform:

    For the installation of netcdf-3.5 on a NEC-SX5 machine (SUPER-UX
    Release 11.1 SX-5), we did the following changes in the code :
    
    - Configuration file "configure" : the Fortran compilation was made
      with the flag -dW i.e. FFLAGS=${FFLAGS--dW}
    
    - C++ compilation :
    
        * ncvalues.h : we replace the occurrence of <strstream.h> by
          <strstream> 
    
        * netcdfcpp.h : we replace the 3 occurrences of
    
            friend NcFile;
    
          with
    
            friend class NcFile;
    
        * ncvalues.cpp : we replace the 2 occurrences of the statement
    
            long save=os.flags();
    
          with
    
            ostream::fmtflags save=os.flags();
    
    - Fortran-90 compilation :
    
        * typeSizes.f90 : we replace the occurrence of
    
            EightByteInt = selected_int_kind(18)
    
          with
    
            EightByteInt = selected_int_kind(10)
    
          and we modified the line 55 :
    
            if (bit_size( One) == 8 .and. bit_size( Two) == 16 .and. &
    
          with
    
            if (bit_size( One) == 16 .and. bit_size( Two) == 16 .and. &
    
          (we could have remove "bit_size(One)" but we preferred to
          keep the general structure of the code)
    
        * netcdf_overloads.f90 : functions with a name containing
          OneByteInt were removed since integers of this size do not
          exist on a NEC-SX5. 
    
    With these modifications, netcdf-3.5 was successfully installed on our
    NEC-SX5.
    


    Cray SV1

    Guntram Seiß of the Bundesanstalt für Wasserbau Dienststelle (Federal Institute for Waterway Engineering) in Hamburg has made a binary version of the netCDF 3.5.0 library and utilities available for Unicos 10.0.0.6 on the Cray SV1. The library includes C, Fortran77, and Fortran90 interfaces. The binary distribution and files that were modified to create it are available from ftp://ftp.unidata.ucar.edu/pub/binary/cray_sv1/.



    Interix on Windows XP Pro

    Leigh Holcombe reports success in building netCDF 3.5.0 under Interix on Windows XP Pro:

    OS: Interix via Windows XP Pro
    
    environment variables:
    % setenv CC /usr/contrib/bin/gcc
    % setenv CXX
    % setenv FC
    % setenv F90
    (since no fortran or C++ compiler was available)
    
    potential issues:
    *using WinZip to untar the archive is a bad idea.  
    
    *failing to set the CC variable will result in a
    successful configure but a failed make, because the
    code defaults to c89 as its compiler, which on this
    system is simply a reference to the MSVisualC++
    compiler, which it won't find unless it is installed
    locally.  gcc works just fine.
    
    *using these same variables, I have had successful
    builds with both versions 3.5.0 and 3.4.0.
    
    *GMT users will want to add the following line to
    their
    /usr/etc/csh.lcl file:
    % setenv NETCDFHOME /usr/local/netcdf-3.5.0
    leave the csh.login and csh.cshrc files alone!  they
    reference the csh.lcl file.
    


    Borland Delphi on Windows

    Sandy Ballard of Sandia National Laboratories has contributed a file of Delphi declarations for netCDF.



    Lahey Fortran 95 compiler on Linux

    Dirk Slawinski has made information about this port available from http://www.per.marine.csiro.au/staff/Dirk.Slawinski/cwr_web/work/netcdfinfo.html.



    Lahey Fortran 95 compiler on Windows NT

    Dirk Slawinski has ported netCDF to this platform and made information about the port available from http://www.per.marine.csiro.au/staff/Dirk.Slawinski/cwr_web/work/netcdfinfo.html#WinNT.



    BeOS

    Jeff Wong has ported netCDF to BeOS. More information about the port is available from http://www.bebits.com/app/1397.



    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.
    



    Mac OS 8.x, 9.x

    Sergey Malyshev has developed a Macintosh version of the netCDF library and udunits, for both PowerPC and 68K, and two MPW tools working with NetCDF files (they are a part of source distribution). This includes the Fortran interface built for Absoft FORTRAN.



    NetBSD

    Eric Fox reports:

    I just wanted to let you know that the "netcdf" software runs on NetBSD 1.3.x (http://www.netbsd.org), with an easy to install package at ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/netcdf/README.html.



    Interix on Windows NT

    Paul Wessel reports:

    Some information that may be useful for others trying to install netCDF under Interix (formerly known as OpenNT). Interix is strictly POSIX and only comes with POSIX include files and libraries.

    1. If using gcc,
      • setenv CC gcc before running configure
      • run configure
      • delete the line containing "values.h" in ncgen/ncgentab.c Otherwise, compilation will fail on all systems that only have POSIX include files.
      • make as usual
      All compiles and tests fine, including g++. Fortran not tested since no Fortran compiler was found.

    2. If using the Microsoft Visual C/C++ compiler (which is accessed via the cc or c89 interface scripts),

      Problem: There is an #ifdef MSC_VER statement that will include io.h rather than unistd.h since the latter does not exist among the MSC include file. However, under OpenNT, only the compiler is used and the include files are the standard POSIX ones. Thus, under OpenNT with c89 we get the error message that io.h is not found. Solution: Perhaps use a different #ifdef that can distinguish between using MSVC in Windows and under OpenNT?



    PowerPC running Linux

    Richard van Hees <R.M.vanHees@fys.ruu.nl> reports:
    I have just installed netcdf-3.4 on my PowerPC running Linux 
    (pmac version 2.1.24), using egcs (instead of gcc-2.7.2).
    
    environment settings:
       CPPFLAGS=-Df2cFortran
       CC=gcc
       CFLAGS="-O2 -fomit-frame-pointer -fsigned-char -pipe"
       FC=g77
       FFLAGS=-O2
       CXX=g++
       CXXFLAGS="$CFLAGS"
    
    The compilations failed, while compiling ncgen/genlib.c due to an unused
    definition at line 1204:
    
    #define fpr    (void) fprintf
    
    removing this line, and everything compiled just fine (C, Fortran and C++)
    
    An RPM package for this platform is available.



    Linux using egcs(1) & g77(1)

    Bill Emanuel <wre6s@cycles.evsc.virginia.edu> reports that the following worked on his Dell Dimension XPS computer running Slackware 3.5 Linux 2.0.34:

    CPPFLAGS='-Df2cFortran -DNDEBUG'
    CC=egcs         # version 2.90.29
    CFLAGS=
    FC=/usr/bin/f77
    FFLAGS="-O -Nx400 -w"
    
    He further notes that if the C compiler is given the -O option, then the configure script fails because a test program wouldn't compile.

    Linux using Portland Group's pgf90 compiler

    Geoffrey Vallis <gkv@splash.princeton.edu> reported that the following settings worked when used in conjunction with the new src/fortran/cfortran.h file that will be in the next release:
    CC=/usr/bin/cc
    CPPFLAGS=-DpgiFortran
    CFLAGS=-g
    FC=pgf90
    FFLAGS="-g -w"
    CXX=/usr/bin/g++
    

    Bill McKie reports further:

    The final hurdle was being able to compile the test routine: netcdf-3.4/src/nf_test/test_put.F with pgf90 during the "make test" phase of the build. The preprocessor for this source file generates a large intermediate Fortran source file with more than 81000 lines and more than 100 internal subprograms. This quantity of lines and/or routines apparently causes an abnormal pgf90 compiler abort when pgf90 is run with default optimization. Turning off optimization in pgf90 with the -O0 switch allowed the compile of test_put.F to proceed. And the entire build was then able to complete to give us a netcdf v3.4 that is linkable with pgcc or pgf90.


    Linux using Kuck & Associates KAI C++ compiler

    Nicola Botta <botta@pik-potsdam.de< reports that the following settings worked for building netCDF-3.4 on a Linux 2.0.32 box with Kuck & Associates KAI C++ compiler:
    CPPFLAGS=-g
    CC='KCC --c'
    CFLAGS=-g
    FC=
    FFLAGS=
    CXX=KCC
    


    MachTen 4.1.1 Unix (on a Mac PPC)

    Hartmut Peters <hpeters@rsmas.miami.edu> reports that the following settings work for building netCDF 3.4 on a Mac PPC under MachTen 4.1.1 Unix (as well as Linux Redhat 5.2 on a Pentium II):
    CPPFLAGS=-Df2cFortran
    CC=/usr/bin/gcc
    CFLAGS=-O
    FC=/usr/bin/g77
    FFLAGS=-O2
    CXX=/usr/bin/g++
    CXXFLAGS=-O
    
    after modifying ncgen/ncgentab.c, exchanging the include file "values.h" (which is obsolete) with "float.h".



    SunOS 5 using gcc(1) and g77(1)

    Randy Arndt <rarndt@aurorasim.com> reports that the following worked:

    $ uname -a
    SunOS atlas 5.5.1 Generic Sun4u sparc SUNW,Ultra-1
    
    CPPFLAGS=-Df2cFortran
    CC=gcc # version 2.7.2.2.f.2
    CFLAGS=-O
    FC=f77 # symbolic link to g77 2.7.2.2.f.2
    FFLAGS=-O
    CXX=c++ # symbolic link to gcc 2.7.2.2.f.2
    


    AIX 3.5

    Kate Hedstrom <kate@ahab.rutgers.edu> reports that the following worked:

    CPPFLAGS='-D_POSIX_SOURCE -DNDEBUG -D_ALL_SOURCE'
    CC=xlc
    CFLAGS=-O
    FC=xlf
    FFLAGS=-O
    CXX=xlC
    


    Linux using g77(1)

    Phil Austin <phil@geog.ubc.ca> reports that the following worked on his Debian 1.3 Linux system:

    $ uname -a
    Linux curlew 2.0.27 #2 Tue May 6 17:57:24 PDT 1997 i686
    
    CPPFLAGS='-Df2cFortran -DNDEBUG'
    CC=/usr/bin/cc # version 2.7.2.1-4
    CFLAGS=-O
    FC=g77 # version 0.5.19.1-1
    FFLAGS=-O
    CXX=/usr/bin/c++
    

    Jan Polcher <Jan.Polcher@lmd.jussieu.fr> reports that he added "-ff2c" to his FFLAGS option.



    Using NAG f90 compiler

    Steve Mauget <smauget@mail.csrl.ars.usda.gov> reports that the following worked on his SGI IRIX 5.3 system:

    CPPFLAGS=
    CC=c89
    CFLAGS=-g
    FC=f90 # NAG
    FFLAGS='-g -mismatch'
    


    HP-UX 10

    We have found that the following works on our new HP-UX B.10.20 system:

    CPPFLAGS='-D_HPUX_SOURCE -DNDEBUG'
    CC=c89
    CFLAGS=-O
    FC=fort77
    FFLAGS='-O3 -w'
    


    This page was prepared by Steve Emmerson.
    Questions or comments can be sent to <support@unidata.ucar.edu>.
     
     
      Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
     
    National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
    P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690