centos6.5: gcc upgrade (5.2.0) process record

   Copyright statement: This article is the original article of the blogger, please indicate the source address for reprinting. https://blog.csdn.net/10km/article/details/78893983

Preparation before installation#

If the system has not installed gcc, g++ compiler (4.4.7), install it first

# Install the old version of gcc, c++translater
sudo yum install gcc gcc-c++

Compile and install#

# Download gcc 5.2.0 source code
wget http://ftp.gnu.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
# Source code decompression
tar xvf gcc-4.9.0.tar.bz2 
cd gcc-5.2.0
# Download some necessary dependent programs
. /contrib/download_prerequisites
mkdir build && cd build
.. /configure --enable-checking=release --enable-languages=c,c++--disable-multilib
# Start to compile, single-threaded compilation takes a long time,
# Can consider using-The j parameter executes parallel compilation such as: make-j8, 8 means 8 threads in parallel,
# But if there is an error in the parallel compilation process, it is sometimes difficult to find
make
# installation,Need root privileges
sudo make install

verification##

Execute gcc --version to verify whether the installation is successful, if the version number is displayed as 5.2.0, the installation is successful

$ gcc –version
gcc (GCC) 5.2.0
Copyright © 2015 Free Software Foundation, Inc.
This program is free software; please refer to the copyright notice of the source code. There is no guarantee for this software;
Including no guarantees of merchantability and suitability for a specific purpose.

You can also execute gcc --v to display more detailed version information (including compilation options)

$ gcc -v
Use built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
The configuration is: ../configure –enable-checking=release –enable-languages=c,c++ –disable-multilib
Thread model: posix
gcc version 5.2.0 (GCC)

Upgrade dynamic library#

After gcc is installed, the libstdc++ dynamic library is not updated, and it still points to version 6.0.13

$ ll /usr/lib64/libstdc++.so.6
lrwxrwxrwx. 1 root root 19 December 25 16:48 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.13

After gcc 5.2.0 is compiled, the dynamic library defaults to the following location:

/usr/local/lib64/libstdc++.so.6.0.21

Manually modify the libstdc++.so.6 soft link to complete the libstdc++ dynamic library update

sudo rm -rf /usr/lib64/libstdc++.so.6  
sudo ln -s /usr/local/lib64/libstdc++.so.6.0.21/usr/lib64/libstdc++.so.6

Error resolution#

configure: error: error verifying int64_t uses long long

The error is caused by not installing g++, it can be solved by installing g++

sudo yum install gcc-c++

References#

"CentOS6.5 gcc upgrade method" https://www.ctguqmx.com/article/233#modile.qq.com
"Gcc 5.2.0 compilation error" http://blog.csdn.net/u012509728/article/details/49923995
"Linux upgrade installation GCC G++ 6.2" http://blog.csdn.net/furzoom/article/details/53322510

Recommended Posts

centos6.5: gcc upgrade (5.2.0) process record
Centos 7 mini installation process record
CentOS7 upgrade python3
Centos6.5 openssh upgrade
Centos python3 compile installation and compile gcc upgrade
Centos7 upgrade kernel
centos6.9 rabbitmq 3.6.8 upgrade 3.8.2
CentOS7.5-1804 system kernel upgrade
Centos 6.4 python 2.6 upgrade to 2.7
Centos 6.4 python 2.6 upgrade to 2.7
CentOS system startup process
Centos kernel version upgrade
Centos system process management
Centos default python2.6 upgrade to
CentOS upgrade python2 to pyth
Server upgrade Ubuntu 20.04 LTS record
CentOS 6.x installation mysql5.7 record
Graphical centos installation detailed process
Server upgrade Ubuntu 20.04 LTS record
Centos7.2 deployment vnc service record
Centos backend system setup record
Centos7 installation tomcat process introduction
Centos6 system boot loading process
Update gcc to 6.4.0 in centos
CentOS8 Linux 8.0.1905 installation process (illustration)
Linux centos system boot process
How to upgrade CentOS7 to CentOS8 (detailed steps)
RabbitMQ cluster deployment record under Centos6.9
Elasticsearch cluster deployment record under CentOS7
How to install GCC on CentOS 8
Centos7 upgrade git version control tool
Linux: Centos7 upgrade the original kernel
Centos6.7 comes with python upgrade to
Remember a centos 7 kernel upgrade accident
Manually upgrade node version under CentOs
FFmpeg environment deployment record under centos7
Manually upgrade node version under CentOs
PPTP environment deployment record under Centos