Compiling OpenMPI-3.1.6 with GCC-6.5

We assumed that you have installed GNU 6.5 and isl-0.15

Download the latest OpenMPI 3.1.6 package from OpenMPI site

./configure --prefix=/usr/local/gnu/openmpi-3.1.6 --with-tm=/opt/pbs --enable-orterun-prefix-by-default --enable-mpi-cxx --enable-openib-rdmacm-ibaddr

–enable-orterun-prefix-by-default (Configure OMPI –enable-orterun-prefix-by-default and so that you do not need to add the prefix option)
–enable-openib-rdmacm-ibaddr (To enable routing over IB)
–enable-mpi-cxx (C++ bindings are no more built by default)

make all install | tee install.log

Using multiple LDFLAGS and CPPFLAGS

In very layman terms,

LDFLAGS refers for linker flags and is often user defined libraries
CPPLAGS is used by the preprocessor and is often the include directory

For example, if I’m compiling multiple LDFLAGS and CPPFLAGS which is required by guile-2.2.4

# ./configure --prefix=/usr/local/guile-2.2.4 LDFLAGS="-L/usr/local/libtool-2.4.6/lib -L/usr/local/gmp-6.1.0/lib" CPPFLAGS="-I/usr/local/libtool-2.4.6/include -I/usr/local/gmp-6.1.0/include"

Reverting back to CMake-3.9.6

When I was compiling CMAKE-3.11.4 with GNU-5.4.0, we encountered the error

"The C++ compiler does not support C++11 (e.g. std::unique_ptr)"

This was rather complex to solve. I believe if I upgrade my GNU Compilers, it might work. Somehow at GNU 5.4, it does not recognize the C++11 support.

But when I downgraded to Cmake-3.9.6, it works immediately without issues. Do look at https://cmake.org/files/v3.9/

# cd $CMAKE_HOME
#./bootstrap
# gmake

Dealing with The compiler /usr/bin/c++ has no C++11 support for CentOS 6

If you compiling using cmake and you make encounter error like this. This is despite the fact that you use the latest compiler like GNU-5.2.0. But somehow the cmake is still looking at the older gnu that comes with CentOS 6

[user1@node1 build]$ cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:24 (message):
The compiler /usr/bin/c++ has no C++11 support. Aborting.

To resolve this, you have to be more explicit in the cmake parameter point to the corrcet g++, gcc

[user1@node1 build]$ cmake .. -DCMAKE_CXX_COMPILER=/usr/local/gcc-5.2.0/bin/g++ -DCMAKE_C_COMPILER=/usr/local/gcc-5.2.0/bin/gcc

Compiling glibc-2.14 on CentOS 6

Step 1: Download glibc-2.14 from GNU Site

# wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz

Step 2: Untar and Preparation

# tar zxvf glibc-2.14.tar.gz
# cd glibc-2.14
# mkdir build
# cd build

Step 3: Compile and install

# ../configure --prefix=/usr/local/glibc-2.14
# make -j8
# make install

Compiling GNU 5.2.0 on CentOS 6

1. Prerequisites:

You will need

  1. gmp 4.3.1-7.el6_2.2
  2. mpfr  2.4.1-6.el6
  3. mpc 0.19-1.el6.rf and
  4. isl-0.14

For 1 to 3, do take a look at Compiling GNU 4.8.1 on CentOS 6. For 4, do take look at Compiling isl-0.15 library

2a. Update linked library at /etc/ld.so.conf

# touch /etc/ld.so.conf.d/library.conf
/usr/local/isl-0.15/lib
/usr/local/mpfr-2.4.2/lib
/usr/local/mpc-0.8.1/lib
/usr/local/gmp-4.3.2/lib

2b. Update your .bashrc

export LD_LIBRARY_PATH=/usr/local/mpfr-2.4.2/lib:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/isl-0.15/lib

3. Compile. This will take a while.

# tar -zxvf  gcc-4.8.1.tar.gz
# cd gcc-4.8.1
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-5.2.0 
--with-mpfr=/usr/local/mpfr-2.4.2 
--with-mpc=/usr/local/mpc-0.8.1 
--with-gmp=/usr/local/gmp-4.3.2
--with-isl=/usr/local/isl-0.14
--disable-multilib
--disable-libmpx
--enable-shared
--enable-languages=c,c++,fortran,go,objc,obj-c++  
--host x86_64-redhat-linux-gnu 
--build x86_64-redhat-linux-gnu
# make -j 16
# make install

References:

  1. Encountering error -static-libstdc++ not implemented when compiling GNU 4.8.1 on CentOS 6
  2. Configure Error when compiling GCC 5.2.0 on CentOS 6.6

Install GCC 4.8.1 and other Scientitic Packages via Yum on CentOS

Do take a look at Linux @ CERN for the documentation on how to use yum to install devtoolset which contain the following packages. The latest version for CentOS 6 is devtoolset-2.1. Here is a summary of the Linux @ CERN

CentOS 6 / SL 6

Developer Toolset 2.1 provides following tools:

  • gcc/g++/gfortran – GNU Compiler Collection – version 4.8.2
  • gdb – GNU Debugger – version 7.6.34
  • binutils – A GNU collection of binary utilities – version 2.23.52
  • elfutils – A collection of utilities and DSOs to handle compiled objects – version 0.155
  • dwz – DWARF optimization and duplicate removal tool – version 0.11
  • systemtap – Programmable system-wide instrumentation system – version 2.1
  • valgrind – Tool for finding memory management bugs in programs – version 3.8.1
  • oprofile – System wide profiler – version 0.9.8
  • eclipse – An Integrated Development Environment – version 4.3.1 (Kepler)

CentOS 5 / SL 5

Developer Toolset 1.1 provides following tools:

  • gcc/g++/gfortran – GNU Compiler Collection – version 4.7.2
  • gdb – GNU Debugger – version 7.5
  • binutils – A GNU collection of binary utilities – version 2.23.51
  • elfutils – A collection of utilities and DSOs to handle compiled objects – version 0.154
  • dwz – DWARF optimization and duplicate removal tool – version 0.7
  • systemtap – Programmable system-wide instrumentation system – version 1.8
  • valgrind – Tool for finding memory management bugs in programs – version 3.8.1
  • oprofile – System wide profiler – version 0.9.7

Installation and Enablement

CentOS 6 / SL 6

Save repository information as /etc/yum.repos.d/slc6-devtoolset.repo on your system:

# cd /etc/yum.repos.d/ 
# wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
# yum install devtoolset-2 --nogpgcheck
# scl enable devtoolset-2 bash

CentOS 5 / SL 5

Save repository information as /etc/yum.repos.d/slc5-devtoolset.repo on your system:

# cd /etc/yum.repos.d/
# wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo
# yum install devtoolset-1.1
# scl enable devtoolset-1.1 bash

Compiling GNU Scientific Library (GSL) gsl-1.16 on CentOS 6

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

Step 1: The current version of GSL is gsl-1.16.tar.gz

Step 2: You may want to use the latest GCC 4.8.1 to compile. For more information on how to compile GCC 4.8.1, see Compiling GNU 4.8.1 on CentOS 6. This compilation will help to fix all the components required for gsl-1.16

Step 3: After packing gsl, To compile

# cd /root/gsl-1.15/
# mkdir build-gsl
# cd build-gsl
# ../configure --prefix=/usr/local/gsl-1.16/
# make 
# make install

Compiling GCC 4.7.2 on CentOS 5

Step 1: Download the following prerequistics applications libraries from ftp://gcc.gnu.org/pub/gcc/infrastructure/

  1. gmp-4.3.2.tar.bz2
  2. mpfr-2.4.2.tar.bz2
  3. mpc-0.8.1.tar.gz

1. Install gmp-4.3.2

# bunzip2 gmp-4.3.2.tar.bz2
# tar -zxvf gmp-4.3.2.tar
# cd gmp-4.3.2
# ./configure --prefix=/usr/local/gmp-4.3.2
# make
# make install

2. Install mpfr-2.4.2 (requires gmp-4.3.2 as prerequisites)

# bunzip2 mpfr-2.4.2.tar.bz2
# tar -zxvf mpfr-2.4.2.tar
# cd mpfr-2.4.2
# ./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2/
# make
# make install

3. Install mpc-0.8.1 (requires gmp-4.3.2 and mpfr-2.4.2 as prerequisites )

# tar -zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1
#./configure --prefix=/usr/local/mpc-0.8.1/ --with-gmp=/usr/local/gmp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2
# make
# make install

4. Update your LD_LIBRARY_PATH at your ~/.bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1:/usr/local/mpfr-2.4.2/lib:/usr/local/gmp-4.3.2/lib

5. Install the glibc-devel.i686. For more information, do look at Error when compiling GCC 4.8.1 (linuxtoolkit.blogspot.com)

6. Finally install GNU CC 4.7.2

# tar -zxvf  gcc-4.7.2.tar.gz
# cd gcc-4.7.2
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-4.7.2 \ 
--with-mpfr=/usr/local/mpfr-2.4.2 \ 
--with-mpc=/usr/local/mpc-0.8.1 \
--with-gmp=/usr/local/gmp-4.3.2 \
--with-mpfr-include=/usr/local/mpfr-2.4.2/include \
--with-mpc-include=/usr/local/mpc-0.8.1/include
# make all-gcc
# make install-gcc

Compiling GNU 4.8.1 on CentOS 6

I encountered error when compiling GCC 4.8.1 on CentOS 6 I have the prequistics (via yum installed)

  1. gmp 4.3.1-7.el6_2.2
  2. mpfr  2.4.1-6.el6
  3. mpc 0.19-1.el6.rf

But still I enountered the error

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. 
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations.  
Source code for these libraries can be found at their respective hosting sites as well as 
at ftp://gcc.gnu.org/pub/gcc/infrastructure/

To resolve the issue, download from the ftp://gcc.gnu.org/pub/gcc/infrastructure/ the following application and compile them.

  1. gmp-4.3.2.tar.bz2
  2. mpfr-2.4.2.tar.bz2
  3. mpc-0.8.1.tar.gz

1. Install gmp-4.3.2

# bunzip2 gmp-4.3.2.tar.bz2
# tar -zxvf gmp-4.3.2.tar
# cd gmp-4.3.2
# ./configure --prefix=/usr/local/gmp-4.3.2
# make
# make install

2. Install mpfr-2.4.2 (requires gmp-4.3.2 as prerequisites)

# bunzip2 mpfr-2.4.2.tar.bz2
# tar -zxvf mpfr-2.4.2.tar
# cd mpfr-2.4.2
# ./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2/
# make
# make install

3. Install mpc-0.8.1 (requires gmp-4.3.2 and mpfr-2.4.2 as prerequisites )

# tar -zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1
#./configure --prefix=/usr/local/mpc-0.8.1/ --with-gmp=/usr/local/gmp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2
# make
# make install

4. Update your LD_LIBRARY_PATH reflect /usr/local/mpc-0.8.1/lib In your .bash_profile include the following

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1

5. Install the glibc-devel.i686. For more information, do look at Error when compiling GCC 4.8.1 (linuxtoolkit.blogspot.com)
6. Finally install GNU CC 4.8.1

# tar -zxvf  gcc-4.8.1.tar.gz
# cd gcc-4.8.1
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-4.8.1 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2
# make
# make install