[gcc] compile and install gcc 4.9.4 on CentOS 7

zilch0
Aug 12, 2021

--

  1. install dependencies
yum update
yum install -y glibc-static libstdc++-static
yum install gcc gcc-c++
yum install bzip2

2. download gcc 4.9.4 source code from gcc official site

3. Decompression

tar -zxvf gcc-4.9.4.tar.gz
cd gcc-4.9.4

4. run dependencies script

./contrib/download_prerequisites

5. compile and install

./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4
make install

6. set environment variables
(if you have gcc-4.8.5 already, this is one way to do this, not the only way.)
edit ~/.bashrc and add :

export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

7. check version

gcc -v

--

--