Wednesday, March 21, 2012

Compiling source code of netcdf4 on linux

First obtain szip libraries (from the link at http://www.hdfgroup.org/HDF5/release/obtain5.html)
wget http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz
tar -xzvf szip-2.1.tar.gz
cd szip-2.1

./configure --prefix=/home/acizmeli/opt
make 
make test
make install

Then obtain the hd5 source code  (again from http://www.hdfgroup.org/HDF5/release/obtain5.html)
wget http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz
tar -xzvf hdf5-1.8.8.tar.gz 
cd hdf5-1.8.8
./configure --prefix=/home/acizmeli/opt  --with-szlib=/home/acizmeli/opt/
(make sure that ./configure has recognized the szip libraries)
make
(or for parallel compilation : ) make -j -16
make install

Then obtain the netcdf4 source :
wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.tar.gz
tar -xzvf netcdf-4.2.tar.gz
cd netcdf-4.2
CPPFLAGS=-I/home/acizmeli/opt/include/ LDFLAGS=-L/home/acizmeli/opt/lib ./configure --prefix=/home/acizmeli/opt/
make
make install

If there is a doxygen error, try adding --disable-doxygen

No comments:

Post a Comment