How can I install gcc-4.8.4 version on Centos 6.8? I've already checked several sources like How to Install gcc 4.7.x/4.8.x on CentOS, but the suggested solutions work by installing some specific devtoolset package. For example "install devtoolset-2-gcc" for gcc-4.8.2, "install devtoolset-3-gcc" for gcc-4.9.2, e.t.c.
Ok I found the solution here
So the steps are:
1.) Install additionally required packages
sudo yum install svn texinfo-tex flex zip libgcc.i686 glibc-devel.i686
2.) Decide which version of GCC you want to install. This command will show you the "tags" for each of the versions available.
svn ls svn://gcc.gnu.org/svn/gcc/tags | grep gcc | grep release
3.) Get the source of the version of GCC you want and download the sources into directory ~/sourceInstallations/gcc_4_8_4_release/
mkdir ~/sourceInstallations cd ~/sourceInstallations svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_4_8_4_release/
4.) Install additional libraries MPFR , GMP, and MPC.
cd gcc_4_8_4_release/ ./contrib/download_prerequisites
5.) Create a separate directory to built gcc there. It is highly recommended that GCC should be built into a separate directory from the sources.
cd .. mkdir gcc_4_8_4_release_build/ cd gcc_4_8_4_release_build/
6.) Build GCC. This will run for hours. If this completes correctly, the last line you will see will say "success".
MENTION: If your computer has multiple processors or cores you can speed it up by building in parallel using make -j 2 (or a higher number for more parallelism). So you can speed up the build by changing the middle part of the below line from "&& make &&" to "&& make -j 'number_of_cores' &&". You can see the number of cores your PC has by running "nproc"
../gcc_4_8_4_release/configure && make && sudo make install && echo "success"
7.) Check the installed versions, and see their locations.
The first line makes your login "forget" about the previously seen locations of gcc and g++
hash -r gcc --version g++ --version which gcc which g++