From OpenFOAMWiki

1 Introduction

This page is dedicated to preparing an CentOS system for installing the foam-extend project OF Version 41ext.png.

2 CentOS versions

2.1 CentOS 7

DISCLAIMER: I do not have a virgin CentOS installation to test this on. The following should work on a new installation, but if you find that there is a package missing, please let me know.

CentOS requires a few packages to be installed in order to compile foam-extend successfully:

Install development environment:

sudo yum -y groupinstall Development\ Tools
sudo yum -y install kernel-devel

And a few more prerequisites:

sudo yum -y install mesa-libGLU rpm-build gcc gcc-c++ libstdc++-devel binutils-devel mercurial zlib-devel

If you want to compile paraview with foam-extend-4.1 (I tend to use a system installation of the most recent paraview, rather than the one provided with foam-extend, 5.7 works nicely on my CentOS 7 installation):

sudo yum -y install qt4-devel

and then before you compile:

export QT_BIN_DIR=/usr/lib64/qt4/bin

CentOS comes with the gcc toolchain 4.8.5, which is not compatible with foam-extend-4.1 (but is the correct one for foam-extend 4.0). Foam-extend-4.1 requires the gcc toolchain 7, which is available from centos-release-scl (at the time of writing gcc7 is not available as a package that will link into the CentOS module system):

Install gcc7 toolchain:

sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-7

Set gcc7 toolchain environment:

source /opt/rh/devtoolset-7/enable

You may find it a good idea to include the last command in your .bashrc if you want to set the gcc7 toolchain as default, but make sure that you understand what that means, it can be safer to only invoke it when needed for foam-extend, since the rest of the system will still need gcc 4.8.5. So only do that if all of your development is on foam-extend.

Then follow the instructions on the previous page, subsection Get the source code. After that continue here to install swak4Foam which will most likely fail due to missing bison 3.

In order to compile swak4Foam, we need to manually start the script that will download and install the requirements for it. CentOS 7 comes with bison 2 and swak4Foam requires bison 3.

To do that:

 cd ThirdParty/rpmBuild/BUILD/swak4Foam-0.4.2