Centos install high version GCC

CentOS7.2 install high version gcc

Other centos series can be referred to, untested, if you have any questions, you can leave a message to discuss

Because some relatively new software requires the latest version of gcc, the version 4.8.5 installed by centos 7.2 using yum install gcc may not meet the requirements of the software. Here is how to toss the latest version of GCC

GCC official website: https://gcc.gnu.org/

My current version is 9.3, so we install the latest version:

01

Installation base dependent environment

yum install glibc-headers gcc-c++ gcc gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel

02

download

**There are many GCC download addresses. We download the gcc source code package from the domestic hust mirror station. **

http://mirror.hust.edu.cn/gnu/gcc/

I chose gcc-9.3.0.tar.gz.

cd
mkdir software
cd software
wget http://mirror.hust.edu.cn/gnu/gcc/gcc-9.3.0/gcc-9.3.0.tar.gz
tar zxvf gcc-9.3.0.tar.gz
cd cc-9.3.0

03

Download the dependency package:

. /contrib/download_prerequisites

04

Configuration

mkdir buildcd build../configure --prefix=/usr/local/gcc-9.3.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib

configure is an executable script that has many options. Use the command ./configure –help to output a detailed list of options in the source path to be installed. The --prefix option is to configure the installation path.

If the --prefix option is not configured, after installation:

The executable file is placed in /usr /local/bin by default,

The library files are placed in /usr/local/lib by default,

The configuration file is placed in /usr/local/etc by default,

Other resource files are placed in /usr /local/share

Detailed explanation of configure parameters:

- - prefix=/usr/local/gcc-9.3.0/: Put all resource files under this path.

- - enable-checking=release: The generated compiler does not perform additional checks during the compilation process.

- - enable-languages=c,c++: Let gcc support c, c++.

- - disable-multilib: Does not generate a cross-compiler compiled into executable code for other platforms.

05

Compile

make

This process takes a long time. Need to be patient

06

installation

make install

07

Aftermath

**If you have not made any mistakes in the above steps, then you have succeeded 90%, and we need some aftermath work: **

01

Delete the old version of gcc downloaded by yum

yum remove gcc

02

Add the new version of gcc to the command search path:

ln -s /usr/local/gcc-9.3.0/bin/gcc /usr/bin/gcc
ln -s /usr/local/gcc-9.3.0/bin/g++/usr/bin/g++

03

Add LD_LIBRARY_PATH environment variable

Add the following code in /etc/profile:

# gccLD_LIBRARY_PATH=/usr/local/gcc-9.3.0/lib#export LD_LIBRARY_PATH

Execute after changing

source /etc/profile

04

Finally replace libstdc++.so.6

cp /usr/local/gcc-9.3.0/lib64/libstdc++.so.6.0.28/usr/lib64/libstdc++.so.6.0.28
rm -f /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.28/usr/lib64/libstdc++.so.6

For those who do not understand the fourth step, you can use

strings /usr/local/gcc-9.3.0/lib64/libstdc++.so.6.0.28| grep GLIBCXX

Compare the difference between /libstdc++.so.6 before and after replacement

If you have any questions, please leave a message, we will toss together

Recommended Posts

Centos install high version GCC
Centos7 install k8s cluster 1.15.0 version
CentOS 8.0.1905 install ZABBIX4.4 version (verified)
Centos7.6 install MySQL+Redis (latest version)
1.5 Install Centos7
How to install GCC on CentOS 8
CentOS6 mininal install CouchDB2 detailed version
Centos6 install Python2.7.13
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
Centos7 install Python2.7
Centos 7.6 install seleniu
Install mysql8.0.13 version under Linux CentOS7 system
Centos install the latest version of cmake
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
How to install GCC compiler on CentOS 7
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8
CentOS 7 install Java 1.8
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual