Message Boards

Back

RE: error compiling Xbeach on linux: libxbeach_la-mnemoniciso.lo

IV
Igor Venancio, modified 1 Month ago.

error compiling Xbeach on linux: libxbeach_la-mnemoniciso.lo

Capillary Posts: 1 Join Date: 2/10/14 Recent Posts

Hey there

I'm trying to compile XBeach on linux on manjaro linux.

I have these compilers versions:

netcdf 4.6.1-2

netcdf-fortran 4.4.4-5

hdf5 1.10.3-1

openmpi 3.1.1-1

$ gfortran --version
GNU Fortran (GCC) 8.2.1 20180831
$ mpich2version
MPICH2 Version:        1.5
MPICH2 Release date:    Mon Oct  8 14:00:48 CDT 2012
MPICH2 Device:        ch3:nemesis
MPICH2 configure:     --prefix=/opt/mpich2 --enable-shared --enable-sharedlibs=gcc --enable-error-checking=runtime --enable-error-messages=all --enable-timer-type=clock_gettime --with-pm=hydra:gforker:mpd --with-python=python2 --disable-rpath --enable-fc --enable-f77 --enable-cxx
MPICH2 CC:     gcc  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -O2
MPICH2 CXX:     c++  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -O2
MPICH2 F77:     gfortran   -O2
MPICH2 FC:     gfortran   -O2

 

So I performed:

./configure --with-mpi --with-netcdf

make

 

and I've got this error:

 

PPFC libxbeach_la-mnemoniciso.lo
mnemoniciso.F90:13:52:

       character(kind=c_char, len=maxnamelen) :: name     ! 'v','ve', .....
                                                    1
Error: Component ‘name’ of BIND(C) type at (1) must have length one
mnemoniciso.F90:14:45:

       character(kind=c_char, len=20) :: units     ! m, following udunits convention
                                             1
Error: Component ‘units’ of BIND(C) type at (1) must have length one
mnemoniciso.F90:15:53:

       character(kind=c_char, len=1024) :: description
                                                     1
Error: Component ‘description’ of BIND(C) type at (1) must have length one
mnemoniciso.F90:16:70:

      character(kind=c_char, len=20), dimension(maxrank) :: dimensions ! the dimensions of the variable, for example (s%nx, s%ny)
                                                                     1

Error: Component ‘dimensions’ of BIND(C) type at (1) must have length one
make[4]: *** [Makefile:718: libxbeach_la-mnemoniciso.lo] Error 1
make[4]: Leaving directory '/home/igor/Programs/xbeach/src/xbeachlibrary'
make[3]: *** [Makefile:489: all] Error 2
make[3]: Leaving directory '/home/igor/Programs/xbeach/src/xbeachlibrary'
make[2]: *** [Makefile:365: all-recursive] Error 1
make[2]: Leaving directory '/home/igor/Programs/xbeach/src'
make[1]: *** [Makefile:417: all-recursive] Error 1
make[1]: Leaving directory '/home/igor/Programs/xbeach'
make: *** [Makefile:349: all] Error 2

 

Is this error caused by the version of the compiler?

 

thanks

Karl Kästner, modified 11 Days ago.

RE: error compiling Xbeach on linux: libxbeach_la-mnemoniciso.lo

Capillary Posts: 1 Join Date: 9/19/15 Recent Posts

Hej Igor,

This also affects Deflt3D-4/Dflow-FM. As suggested, this is due to an incompatibility of the source code with the GNU compiler 8, see https://gcc.gnu.org/onlinedocs/gfortran/Interoperable-Subroutines-and-Functions.html).
The simplest way is to work on an old system if available, such as Ubuntu 14 or 16, not 18.

Otherwise this tedious workaround for Delft3D on Ubuntu 18.10 might for you as well:
1) Install the old version of gfortran
sudo apt-get install gfortran-7

2) Choose the old version the default
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 10

3) Rebuild the system's mpich libraries with gfortran-7, as otherwise they won't link:

sudo apt-get install build-essential
apt-get source libmpich-dev
sudo apt-get build-dep libmpich-dev
cd mpich-3.3~b2
dpkg-buildpackage -rfakeroot -b
sudo make install

4) Repeat the step 3 for libnetcdff-dev

5) Patch mpi-path in build.sh with the attached file.

                  


patch src/build.sh build.sh.patch

6) Patch file opening flags in oc.c with the attached file.
patch ./src/utils_lgpl/nefis/packages/nefis/src/oc.c oc.c.patch

7) Get rid of all modules already compiled with gfortran-8
make clean

8) Build delft3d
cd src
./build.sh -gnu

9) Append bin folder to path in ~/.bashrc
export PATH={path to your xbeach build folder}/src/bin:$PATH

10) Make path to take effect in the current bash
source ~/.bashrc

11) Happy Xbeaching