This post walks through a full FLEXPART v11 installation for ECMWF meteorological data with NetCDF and Fortran support, including resolving common compilation issues. All components were built from source on a Linux HPC system with user-level access.
All components (GCC, HDF5, NetCDF, ecCodes, etc.) will be installed under this directory tree.
🔧 Step-by-Step Build Pipeline
1. GCC 13.2.0 (with Fortran Support)
1 2 3 4 5 6 7 8
wget https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz tar -xzf gcc-13.2.0.tar.gz cd gcc-13.2.0 ./contrib/download_prerequisites mkdir build && cd build ../configure --prefix=$DIR/gcc-13.2.0 --enable-languages=c,c++,fortran,go --disable-multilib make -j$(nproc) make install
wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/downloads/hdf5-1.14.6.tar.gz tar -xzf hdf5-1.14.6.tar.gz cd hdf5-1.14.6 ./configure --prefix=$DIR/hdf5 --enable-cxx --enable-fortran --enable-shared make -j$(nproc) make install
h5cc -showconfig ## check whether it is installed properly
3. NetCDF (C + Fortran)
3.1 NetCDF-C
1 2 3 4 5 6 7 8 9 10 11
wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.3.tar.gz -O netcdf-c-4.9.3.tar.gz tar -xzf netcdf-c-4.9.3.tar.gz cd netcdf-c-4.9.3 ./configure --prefix=$DIR/netcdf \ CPPFLAGS="-I$DIR/hdf5/include" \ LDFLAGS="-L$DIR/hdf5/lib" \ --enable-netcdf-4 --disable-dap make -j$(nproc) make install
nc-config --all ## check whether it is installed properly
3.2 NetCDF-Fortran
1 2 3 4 5 6
wget https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz -O netcdf-fortran-4.6.1.tar.gz tar -xzf netcdf-fortran-4.6.1.tar.gz cd netcdf-fortran-4.6.1 ./configure --prefix=$DIR/netcdf make -j$(nproc) make install
4. OpenMPI (Optional for MPI mode)
1 2 3 4 5 6 7 8
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.gz tar -xzf openmpi-4.1.6.tar.gz cd openmpi-4.1.6 ./configure --prefix=$DIR/libs/openmpi make -j$(nproc) make install export PATH=$DIR/libs/openmpi/bin:$PATH export LD_LIBRARY_PATH=$DIR/libs/openmpi/lib:$LD_LIBRARY_PATH
5. AEC Library (Required by ecCodes)
1 2 3 4 5 6
wget https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6/libaec-v1.0.6.tar.gz tar -xzf libaec-v1.0.6.tar.gz cd libaec-v1.0.6 && mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=$DIR/libaec make -j$(nproc) make install
6. ecCodes (with Fortran and NetCDF)
1 2 3 4 5 6 7
wget https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.33.0-Source.tar.gz tar -xzf libaec-v1.0.6.tar.gz # Unpack and build cd eccodes-2.33.0-source && mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=$DIR/eccodes -DCMAKE_PREFIX_PATH="$DIR/netcdf;$DIR/hdf5;$DIR/libaec" -DENABLE_NETCDF=ON -DENABLE_FORTRAN=ON -DCMAKE_BUILD_TYPE=Release make -j$(nproc) make install
wget https://gitlab.phaidra.org/flexpart/flexpart/-/archive/v11/flexpart-v11.tar.gz tar -xzf flexpart-v11.tar.gz cd flexpart-v11 # the place to change in the ./src/makefile_gfortran is the F90 = /data/user/hao_y/lib/gcc-13.2.0/bin/gfortran make -f makefile_gfortran -j4 eta=no ncf=yes
eta=no: Use hybrid ECMWF coordinate system
ncf=yes: Enable NetCDF support
❌ Common Errors and Fixes
Error
Cause
Solution
cannot find -leccodes_f90
ecCodes built without Fortran
Add -DENABLE_FORTRAN=ON
AEC library not found
libaec missing
Install libaec and add to CMAKE_PREFIX_PATH
GLIBCXX_3.4.30 not found
Old libstdc++ in system
Build newer GCC (>=13) and use its lib path
gfortran: command not found
GCC built without Fortran
Rebuild with --enable-languages=c,c++,fortran
📅 Final Notes
Think of ./configure as the blueprint, make as construction, and make install as moving into your house and wiring the electricity. You now have a clean, custom-built FLEXPART environment with all dependencies resolved, ready to simulate ECMWF-based transport at scale.
when copy the setting from another PC into the release folder, you need to change the permission of the folder by typing chmod -R 755 ./options and chmod 644./options/RELEASES or any other files.
For multi-core processing, you can use the export OMP_NUM_THREADS=4 to set 4 cores (can set for more) and then with ./FLEXPART command to run FLEXPART with multiple processes.
Sometimes, we will find error of “Program received signal SIGSEGV: Segmentation fault - invalid memory reference.” By typing ulimit -s unlimted, we can solve this problem.
Comments