Because we need to use C 11, but the gcc4.4.7 that comes with CentOS does not support it, we decided to upgrade gcc.
The operation is as follows:
#Backup
mv /etc/yum.repos.d/devtools-2.repo /etc/yum.repos.d/devtools-2.repo.bak wget http://people.centos.org/tru/devtools-2 /devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils
yum install devtoolset-2-gcc-c
These three files will be downloaded to: /opt/rh/devtoolset-2/root/, and then set the soft link:
#Back up the original 4.4.7 version
mv /usr/bin/gcc /usr/bin/gcc-4.4.7
mv /usr/bin/g /usr/bin/g -4.4.7
mv /usr/bin/c /usr/bin/c -4.4.7
#Set soft link
ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-2/root/usr/bin/c /usr/bin/c
ln -s /opt/rh/devtoolset-2/root/usr/bin/g /usr/bin/g
gcc -v
The above is the detailed content of Detailed explanation of the steps to upgrade gcc using yum on CentOS6.5. For more information, please follow other related articles on the PHP Chinese website!