CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [foam-extend.org] Installation in devtoolset environment (SL/CentOS/Redhat) (https://www.cfd-online.com/Forums/openfoam-installation/212633-installation-devtoolset-environment-sl-centos-redhat.html)

zordiack December 5, 2018 07:59

Installation in devtoolset environment (SL/CentOS/Redhat)
 
Hi, I though I would share my recent experiments with foam-extend-4.0 installation in devtoolset-6 environment because installation was not that smooth :)

For unspecified reasons our current computation nodes are running a rather old distribution SL 6.10 and compiler and binutils in the default system are too old for compiling new versions of OpenFOAM. I suspect that having to use old distributions is a situation that might be familiar to others too.. Anyhow, Redhat derivatives have one solution for such problems and it's called devtoolset.

To install one could simple use (you need root permissions or sysadmin to do it for you):

Code:

yum install devtoolset-6
After installing you have to switch using the new developer environment:

Code:

scl enable devtoolset-6 bash
Now you can enjoy more recent development tools, for example gcc:

Code:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-6/root/usr --mandir=/opt/rh/devtoolset-6/root/usr/share/man --infodir=/opt/rh/devtoolset-6/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-6.3.1-20170216/obj-x86_64-redhat-linux/isl-install --enable-libmpx --with-mpc=/builddir/build/BUILD/gcc-6.3.1-20170216/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)

However, I stumbled upon a bug when I tried to compile foam-extend-4.0 and ThirdParty components. For some reason the wrong (original, not devtoolset) version of strip is used in devtoolset environment and this will cause compilation failure of several ThirdParty components. Here are a couple of links I found about the issue:


https://stackoverflow.com/questions/...one-relocation
https://bugzilla.redhat.com/show_bug.cgi?id=1545386
https://gitlab.cern.ch/eos/quarkdb/c...ff897e29d415fc


Since foam-extend is using rpmbuild for installing ThirdParty stuff, one workaround for this issue is to modify rpmbuild spec files. For example:

Code:

nano ThirdParty/rpmBuild/SPECS/metis-5.1.0.spec
and insert the following line starting with %global:

Code:

..snip..

# Disable the generation of debuginfo packages
%define debug_package %{nil}

%global __strip /opt/rh/devtoolset-6/root/usr/bin/strip

# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
..snip..

Please note that the line will have to be modified according to the devtoolset version that is in use, I happen to use devtoolset-6. This modification needs to be added to all .spec files that are going to be compiled, I did this manually but other means should exist.


After that modification, compilation of foam-extend-4.0 succeeded without errors in devtoolset environment :)


All times are GMT -4. The time now is 06:06.