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 0 vote
Article Rating
赞(0) 打赏
未经允许不得转载:iemblog » How To Upgrade GCC In Centos 6
Notify of
Inline Feedbacks
View all comments
免责声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,请在下载后24小时之内自觉删除,若作商业用途,请购买正版,由于未及时购买和付费发生的侵权行为,与本站无关。本站发布的内容若侵犯到您的权益,请联系站长删除,我们将及时处理! Disclaimer: Most of the download resources on this site are collected on the Internet, and are only used for learning and communication. The copyright belongs to the original author. Please consciously delete within 24 hours after downloading. If you use it for commercial purposes, please purchase the original version. If the content posted on this site violates your rights, please contact us to delete it, and we will deal with it in time!

联系我们 Contact us




Would love your thoughts, please comment.x