We need a modern C++11 capable compiler. Our minimum requirements are: GCC 4.8.4, Clang 3.4.0. This section will focus on building a GCC 7.3.1 compiler stack.
What version of GCC do we have?
gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If your version is less than 4.8.4, you will need to build a newer version. If your version is at or greater than 4.8.4, you have the option of skipping the GCC section.
cd $STACK_SRC curl -L -O http://mirrors.concertpass.com/gcc/releases/gcc-7.3.1/gcc-7.3.1.tar.gz tar -xf gcc-7.3.1.tar.gz -C .
Obtain GCC pre-reqs:
cd $STACK_SRC/gcc-7.3.1 ./contrib/download_prerequisites
Configure, build and install GCC:
mkdir $STACK_SRC/gcc-build cd $STACK_SRC/gcc-build ../gcc-7.3.1/configure --prefix=$PACKAGES_DIR/gcc-7.3.1 \ --disable-multilib \ --enable-languages=c,c++,fortran,jit \ --enable-checking=release \ --enable-host-shared \ --with-pic make -j # (where # is the number of cores available) make install
Any errors during configure/make will need to be investigated on your own. Every operating system I have come across has its own nuances of getting stuff built. Normally any issues are going to be solved by installing the necessary development libraries using your system package manager (apt-get, yum, zypper, etc). Hint: I would search the internet for 'how to build GCC 7.3.1 on (insert the name/version of your operating system here)'
In order to utilize our newly built GCC 7.3.1 compiler, we need to set some variables:
export PATH=$PACKAGES_DIR/gcc-7.3.1/bin:$PATH export LD_LIBRARY_PATH=$PACKAGES_DIR/gcc-7.3.1/lib64:$PACKAGES_DIR/gcc-7.3.1/lib:$PACKAGES_DIR/gcc-7.3.1/lib/gcc/x86_64-unknown-linux-gnu/7.3.1:$PACKAGES_DIR/gcc-7.3.1/libexec/gcc/x86_64-unknown-linux-gnu/7.3.1:$LD_LIBRARY_PATH