Build Delft3D on Ubuntu 16.04 of WSL using GNU compiler

Table of Contents
This post is a memorandum on building Delft3D on Ubuntu 16.04 of WSL on Windows 10 Pro. I tried to build Delft3D on Ubuntu 18.04 with Intel compiler, but it did not work, and thus following the information here, I built Delft3D on Ubuntu 16.04 with the GNU compiler. (Posted on June 12, 2019)


First, set the Windows shared folder. Add the following to the end of ~/.bashrc so that you can access the Windows C drive as ~/winc.

if [ -d winc ]; then
  echo "Windows shared folders ready"
  ln -s /mnt/c winc

In order to reflect the changed .bashrc , execute the following in your home directory:

source .bashrc

Proceed as follows. You may not need to install some of the following.

sudo apt update
sudo apt upgrade

sudo apt install build-essential subversion autoconf libtool
sudo apt install bison flex g ++ gfortran libstdc ++ 6 byacc libexpat1 libexpat1-dev
sudo apt install uuid-dev ruby ​​make
sudo apt install libcurl4-openssl-dev
sudo apt install -y pkg-config

Install required tools

Next we will build the necessary tools. Create and move a build directory. Here, we will work in ~/src which was created below the home directory.


Installation of MPICH-3.2 takes a very long time.

tar -xzf mpich-3.2.tar.gz
cd mpich-3.2
./configure --prefix=/opt/mpich-3.2
sudo make install
cd ..


tar -xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib-1.2.8
sudo make install
cd ..


tar -zxf hdf5-1.8.16.tar.gz
cd hdf5-1.8.16
./configure --prefix=/usr/local/hdf5-1.8.16 --with-zlib=/usr/local/zlib-1.2.8
sudo make install
cd ..

netCDF4-C and netCDF4-Fortran

tar -xzf v4.4.1.tar.gz
cd netcdf-c-4.4.1
./configure --prefix=/usr/local/netcdf4.4 --enable-netcdf-4 --enable-shared --enable-dap CPPFLAGS="-I/usr/local/hdf5-1.8.16/include -I/usr/local/zlib-1.2.8/include -I/usr/local/netcdf4.4/include" LDFLAGS="-L/usr/local/hdf5-1.8.16/lib -L/usr/local/zlib-1.2.8/lib -L/usr/local/netcdf4.4/lib"
sudo make install
cd ..

tar -xzf v4.4.4.tar.gz
cd netcdf-fortran-4.4.4
./configure --prefix=/usr/local/netcdf4.4 --enable-shared CPPFLAGS="-I/usr/local/hdf5-1.8.16/include -I/usr/local/netcdf4.4/include" LDFLAGS="-L/usr/local/hdf5-1.8.16/lib -L/usr/local/netcdf4.4/lib"
sudo make install
cd ..

Building Delft3D

Set a directory where the source code is downloaded like /home/teem/winc/cal/Delft3D and move it here. Here, /home/teem is supposed to be the home directory, and /winc is the Windows C drive that was set up at the beginning. Checkout with subversion. The download took about one hour and twenty minutes.

svn checkout delft3d_repository

If an error like svn: E120106: ra_serf: The server sent a truncated HTTP response body. appeared, change directory to delft3d_repository and execute the following:

svn cleanup
svn update

Move to delft3d_repository/src, which is created under the current directory, and edit three locations in as follows:
Edit between if ["$ compiler" = 'gnu']; then and else around line 260 as follows.

if [ "$compiler" = 'gnu' ]; then
    addpath PATH /opt/mpich-3.2/bin
    export MPI_INCLUDE=/opt/mpich-3.2/include
    export MPILIBS_ADDITIONAL="-L/opt/mpich-3.2/lib -lfmpich -lmpich -lmpl"
    export MPIFC=/opt/mpich-3.2/bin/mpif90

Next, edit one line related to netcdf in around line 300 as follows:

        ./configure --prefix=/home/teem/winc/cal/Delft3D/delft3d_repository $configureArgs &> $log \

Finally, edit the part beginning with ./configure around line 385 as follows according to the installation location of the source code. The executable will be installed in the directory specified here.

        ./configure --prefix=/home/teem/winc/cal/Delft3D/delft3d_repository $configureArgs &> $log \

Now that you are ready and build it. This will take long time.

./ -gnu -64bit

Test case execution (not yet confirmed here)

Create a script for setting environment in /home/teem/winc/cal/Delft3D/delft3d_repository with the following contents.

export PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/flow2d3d/bin:$PATH
export PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/wave/bin:$PATH
export PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/swan/scripts:$PATH
export LD_LIBRARY_PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/flow2d3d/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/wave/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/swan/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/teem/winc/cal/Delft3D/delft3d_repository/bin/lnx64/swan/scripts:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/mpich-3.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/mpich-3.2/bin:$PATH

Every time before start working on Delft3D, the environmental variables should be set:

source /home/teem/winc/cal/Delft3D/delft3d_repository/


  1. Paul Liu. Successfully installed and run Delft3d on Amazon AWS Ubuntu 16.04 (EC2). url
  2. tmegos blog. svn: E120106: ra_serf: The server sent a truncated HTTP response body. url

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.