How To Upgrade GCC In Centos 6

Here I only shows manual upgrade of GCC to 4.8.1 (other higher versions are similar methods, GCC6 and GCC8 have been tested).

How to Upgrade GCC In Centos 6

Manual compilation and installation

Manually compile and upgrade GCC to 4.8.1

  1. Install Development Tools
yum groupinstall "Development Tools"
  1. Install glibc-devel.i686 (the 32-bit version is required to build GCC)
yum install glibc-devel.i686
  1. Download GCC 4.8.1

Compiling GCC requires a large enough space (5G or more), Please make sure that there is enough free space on the disk. I chooses to operate directly in the root directory.

cd /root
  1. Unzip and compile and install
tar -jxvf gcc-4.8.1.tar.bz2
cd gcc-4.8.1
cd ..
mkdir objdir
cd objdir
../gcc-4.8.1/configure --prefix=/usr
make -j4
make install

Using a third-party Repo library installation

SCL library

Using a third-party library SCL (software selection) of CentOS, SCL can install a new software package and coexist with the old software package without overwriting the original system software package and can use the scl command to switch, but there is also a disadvantage that only 64 is supported. Bit. Also devtoolset-4 (gcc 5.2) and previous versions have been supported, and can only be installed by other methods.

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash  

Which version do you want to change the number 8 in the second command to the major version number you want? This upgrade to the latest version, such as 8 upgrade to 8.2.0 instead of 8.1.

Start gcc with the scl command. This is only temporary. When your shell is closed or restarted, the original version will be restored. To use the upgraded version all the time, you can use the following command:

echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile
source /etc/profile
赞(0) 打赏
未经允许不得转载:iemblog » How To Upgrade GCC In Centos 6

Comment Time!

:arrow: :-D :-? 8) :cry: 8-O :evil: :!: :idea: :lol: :-x :mrgreen: :-| :?: :-P :oops: :roll: :( :) :-o :twisted: :wink: :hold-fist-salute: :love-you: :no: :ok: :poor: :seduce: :shake-hands: :strong: :victory:
Notify of