Building NetCDF* with the Intel® compilers


This guide is intended to help Intel® Fortran Compiler customers build the NetCDF software libraries on Intel® architecture systems running Linux* or Mac OS*. This guide will also cover use of the Intel® C++ Compiler, although it is not required to build NetCDF.

NetCDF (Network Common Data Form) is a machine-independent, self-describing, binary data format standard for exchanging scientific data. Information about NetCDF can be obtained from the University Corporation for Atmospheric Research (UCAR), website:

Version Information

NetCDF 4.1.3 or later
Intel® C++ Compiler for Linux* or Mac OS* X
Intel® Fortran Compiler for Linux* or Mac OS* X

Obtaining the Source Code

The source code is available for download from

Obtaining the latest version of the Intel® compilers

Licensed users of the Intel® compilers may download the most recent versions of the compiler from the Intel® Software Development Products Registration Center. Evaluation versions of the Intel® compilers may be found at the Intel® Software Evaluation Center.


Additional software packages may be required when building NetCDF. Please check the NetCDF website for details.

Configuration and Setup Information

In order to use this guide, you will need to have the Intel® C++ Compiler and the Intel® Fortran Compiler installed on your build system. After installing the compilers, you will need to execute one of the following commands below, depending on your architecture, to set the environment variables.

source <compiler_install_dir>/bin/ ia32
source <compiler_install_dir>/bin/ intel64

After downloading the NetCDF tar file, extract the NetCDF source code in a work directory.

cd <work_directory>
tar -xvzf netcdf-

Note: The instructions below apply to both Linux* and Mac OS* X unless otherwise noted.

Building NetCDF

The NetCDF build process starts with a configuration step. The configuration script uses environment variables to select the compilers and compiler options to use when building NetCDF. Begin by setting the following environment variables.

For Linux*:

export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=ifort
export FC=ifort
export F90=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CPP='icc -E'
export CXXCPP='icpc -E'

For Mac OS* X:

export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div'
export F77=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -mdynamic-no-pic'

Note: The -xHost compiler option will generate code using the highest instruction set available on the build system's processor.

After the environment variables are exported, perform the configuration step by changing your directory to the NetCDF source directory and running the configuration script. The configuration script will set up the Makefiles that will be used to build the NetCDF libraries and utilities. It will also set up the installation directory for the default location of /usr/local. If you would like to install the libraries in another location, use the --prefix= option with the configure command:

cd netcdf-4.1.3
./configure --prefix=/your/desired/install/directory

When the configuration step completes successfully, you can build the libraries, test the build, and then install the software.

make check
make install

Known Issues and Limitations

At this time, there are no known issues with using the Intel compilers to build NetCDF. Please see the NetCDF website for all known issues and limitations.

For more complete information about compiler optimizations, see our Optimization Notice.


Vanessa, what you're missing is 'ifort' itself. You don't have your PATH variable set correctly it seems.

Once I install ifort, I set /etc/profile and add to PATH and MANPATH environment variables the respective binary and manual directories for ifort (usually something inside /opt/intel/Compiler...), and also I add the 'lib' (lib32 or lib64 depending on my system) to /etc/, and 'ldconfig' so the shared objects are viewable to the whole system.

I hope these directions help. If you are lost, you could ask who installed ifort to fix its patches or if it were you, read thru the installation guide again for 'skipped' steps.

Hello... i'm trying to install netcdf 3.6.2 using intel compilers without success. I follow the steps in this page but when I type make check I have this error:

make all-recursive
make[1]: se ingresa al directorio `/home/usuario/netcdf-3.6.2'
Making all in f90
make[2]: se ingresa al directorio `/home/usuario/netcdf-3.6.2/f90'
/bin/sh ../libtool --mode=compile ifort -I../libsrc -I. -g -c -o typeSizes.lo typeSizes.f90
libtool: compile: ifort -I../libsrc -I. -g -c typeSizes.f90 -o typeSizes.o
../libtool: line 795: ifort: command not found
make[2]: *** [typeSizes.lo] Error 1
make[2]: se sale del directorio `/home/usuario/netcdf-3.6.2/f90'
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio `/home/usuario/netcdf-3.6.2'
make: *** [all] Error 2

I used the command source and export... what I'm missing?

Mike: -ipo, yes this can cause some adverse name mangling. And it is not clear that -ipo buys any more over -ip. I'll update this knowledge base article.

Yajivbs: your g++ is either not installed or not at the same version as your gcc. Get g++ at the same version as gcc and make sure both work. Then try icc icpc with simple hello world programs before you dive into something as complex as netCDF.

Nick, I'll add your FC and F90 notes. And it is probably time for a netCDF 4.0 KB.

FYI...I could not get to compile with F90 until I set the following:
setenv FC ifort
setenv F90 ifort

I have installed the ifort 11.0 and icc 11.0 in my work station. Now I am installing the netcdf-3.6.3. While installing I got the following error.
> configure:3596: icc --version >&5
> icc: error #10149: option '-cxxlib-gcc' not supported with the current installed GCC
> configure:3600: $? = 1
> configure:3607: icc -v >&5
> Version 11.0
> configure:3611: $? = 0
> configure:3618: icc -V >&5
> Intel(R) C Intel(R) 64 Compiler Professional for applications running on
> Intel(R) 64, Version 11.0 Build 20081105 Package ID: l_cproc_p_11.0.074
> Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
> configure:3622: $? = 0
> configure:3645: checking for C compiler default output file name
> configure:3667: icc conftest.c >&5
> icc: error #10149: option '-cxxlib-gcc' not supported with the current installed GCC
> configure:3671: $? = 1
> configure:3709: result:
> configure: failed program was:
> | /* confdefs.h. */
> Kindly help me to solve this problem
> Regards
> Vijay

Just had a failed configure with Intel 10.1 on NetCDF 4.0.1 - the root cause seems to be the -ipo flag

In order to work out the specific fortran function name mangling, configure generates object code from a simple fortran program:

call sub()

and then runs nm on the object code and attempts to grep out the correct symbol style (SUB, SUB_, sub or sub_). Basic symbol table without -ipo is:

0000000000000000 r LITPACK_0.0.0
0000000000000000 T MAIN__
U __intel_new_proc_init
U for_set_reentrancy
U sub_

Adding the -ipo flag gives the following nm output:

w __ildata_included

configure can't find a match and bails

I just want to know what you meant in the above material:
in the compiler bin/ directory. For example:

$ source /opt/intel/cce/
$ source /opt/intel/fce/

where is the compiler bin/ directory, could you be kind to show me how to get this subdirectory. right now i am in /home/naishi/netCDF; namely the working directory.
Thank you for your help!

We need help with the FORTRAN bindings using Intel Visual Fortran for Windows. In particular, cfortran.h does not support Visual Fortran. Using the old PowerStationFortran setting does not play well because it uses the older calling convention.

Note, the f90 bindings DEPEND on the the FORTRAN bindings.

Thanks, Roy