Building Elmer in Linux Mint 17.1

Discussion about building and installing Elmer
Post Reply
staurolite
Posts: 12
Joined: 04 Feb 2012, 03:49
Antispam: Yes

Building Elmer in Linux Mint 17.1

Post by staurolite »

I've just rebuilt Elmer from a fresh subversion download on a newly installed 64-bit Linux Mint 17.1 machine. (Mint 17.1 is derived from Ubunti 14.04, so this may be useful for users of the latter, too.) Below are all of the patches I had to apply to build successfully and to pass all of the tests in (cd fem ; make check), along with compile.sh scripts for both non-MPI and MPI builds and suitable .bashrc entries. Some of these patches have to do with libraries, but others involve typos in the source. I hope this may prove helpful to others.

======================================================================================================

PATCHES to elmerfem/fem/src/binio/test/
2015-02-12

-------------------------------

readtest.sh -- missing closing quote; extraneous blank space


2,3c2,3
< ok=`./readtest|sed -e "s/^ *//"`
< [ "$ok" = "OK" ]
---
> ok=`./readtest|sed -e "s/^ *//`
> [ "$ok" = " OK" ]

-------------------------------

======================================================================================================

PATCHES to elmerfem/fem/src/modules/
2015-02-12

-------------------------------

Makefile -- missing FourierLoss in BINARIES list:

test 188 : mgdyn_transient_loss 0, look at [mgdyn_transient_loss/test.log] for details


elmerfem/fem/tests/mgdyn_transient_loss/test.log:

Loading user function library: [FourierLoss]...[FourierLossSolver_Init0]

Load: Unable to open shared library: [FourierLoss]
FourierLoss: cannot open shared object file: No such file or directory

Load: Unable to open shared library: [FourierLoss.so]
FourierLoss.so: cannot open shared object file: No such file or directory

Load: Unable to open shared library: [./FourierLoss]
./FourierLoss: cannot open shared object file: No such file or directory

Load: Unable to open shared library: [./FourierLoss.so]
./FourierLoss.so: cannot open shared object file: No such file or directory

Load: Unable to open shared library: [/usr/local/elmer/share/elmersolver/lib/FourierLoss]
/usr/local/elmer/share/elmersolver/lib/FourierLoss: cannot open shared object file: No such file or directory

Load: Unable to open shared library: [/usr/local/elmer/share/elmersolver/lib/FourierLoss.so]
/usr/local/elmer/share/elmersolver/lib/FourierLoss.so: cannot open shared object file: No such file or directory
make[3]: Leaving directory `/usr/local/elmer/elmerfem/fem/tests/mgdyn_transient_loss'


Workaround is to add:
FourierLoss$(SHL_EXT) \
to BINARIES in Makefile.in

-------------------------------

======================================================================================================

PATCHES to elmerfem/fem/tests/mgdyn_harmonic_loss
2015-02-12

-------------------------------

ELMERSOLVER_STARTINFO file is missing:

ERROR:: ElmerSolver: Unable to find ELMERSOLVER_STARTINFO, can not execute.


Workaround is:
echo MGDynamicsHarmonic.sif > ELMERSOLVER_STARTINFO

-------------------------------

======================================================================================================

PATCHES to elmerfem/post
2015-02-11

-------------------------------

matctcl.c:82:18: error: ‘Tcl_Interp’ has no member named ‘result’

This happens because we are buildig using Tcl 8.6.
Tcl 8.5 deprecated interp->result and Tcl 8.6 removed it.

The workaround is to define:
CPPFLAGS="-DUSE_INTERP_RESULT"
in the ../compile.sh script.

-------------------------------

/usr/bin/ld: ./tk/libtk.a(window.o): undefined reference to symbol 'XGetErrorText'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line

This happens because tk/libtk.a(window.o) uses symbols from libX11 but the buildsystem
doesn't explicitly link to libX11.

Adding -lX11 to LDFLAGS does not fix the problem, because linking is dependent on the order
of modules, with symbols first requested and then linked in from a library that has them,
and the LDFLAGS approach causes libX11 to be searched before libtk calls for XGetErrorText.

The workaround is to alter line 9983 of ./configure (drawn from line 1716 of acx_elmer.m4):
# TCLTK_LIBS="-L$l $TK_LIBS $TCL_LIBS"
TCLTK_LIBS="-L$l $TK_LIBS $TCL_LIBS -lX11"
to add -lX11 explicitly.

-------------------------------


======================================================================================================

#! /bin/sh -f
# elmerfem/compile.sh
# build all Elmer components (without MIP)

# select the compilers (here the gcc suite)
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran

# the compiler flags
export CFLAGS=""
export FCFLAGS=""
export F77FLAGS=""
export FFLAGS=""

# linking
export LDFLAGS=""

# paths
export ELMER_HOME="/usr/local/elmer"

# modules
s="matc umfpack mathlibs elmergrid meshgen2d eio hutiter fem"

export CPPFLAGS="-DHYPRE_SEQUENTIAL"

# configure and build
for m in $s; do
cd $m
./configure --prefix=$ELMER_HOME

make
make install
cd ..
done

# special (patched) module
s="post"

export CPPFLAGS="-DUSE_INTERP_RESULT"

# configure and build
for m in $s; do
cd $m
./configure --prefix=$ELMER_HOME
make
make install
cd ..
done

======================================================================================================

#! /bin/sh -f
# elmerfem/compile_MIP.sh:
# build all Elmer components (with MIP)

# select the compilers (here the gcc suite)
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran

# the compiler flags
export CFLAGS=""
export FCFLAGS=""
export F77FLAGS=""
export FFLAGS=""

# linking
export LDFLAGS=""

# paths
export ELMER_HOME="/usr/local/elmer"

# modules
s="matc umfpack mathlibs elmergrid meshgen2d eio hutiter fem"

# configure and build
for m in $s; do
cd $m
./configure --prefix=$ELMER_HOME --with-mpi=yes --with-mpi-dir=/usr/lib/openmpi --with-mpi-library="-lmpi -lmpi_f77"

make
make install
cd ..
done

# special (patched) module
s="post"

export CPPFLAGS="-DUSE_INTERP_RESULT"

# configure and build
for m in $s; do
cd $m
./configure --prefix=$ELMER_HOME
make
make install
cd ..
done

======================================================================================================

# ~/.bashrc

# config for ELMER
export ELMER_HOME="/usr/local/elmer"
export PATH="$PATH:$ELMER_HOME/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ELMER_HOME/lib"
export ELMERGUI_HOME="$ELMER_HOME/bin"

======================================================================================================
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Building Elmer in Linux Mint 17.1

Post by annier »

Hi Staurolite,
Thank you very much for the solutions. Your post is a useful information for us (Linux users).


Yours
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Building Elmer in Linux Mint 17.1

Post by raback »

Hi staurolite

Thanx for the instructions! You might note that we have moved over to cmake on GitHub and will not continue to support the gnu autotools version hosted on svn at sourceforge. These instructions thus show how to compile this last frozen version.

-Peter
Post Reply