用户工具

站点工具


zh:notes:update_gcc

Update gcc

Operation System

CentOS 6.8 (64 bits), CentOS 7.6 (64 bits)

Download the Latest Version

> wget http://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz
> tar -zxvf gcc-10.2.0.tgz
> rm -f gcc-10.2.0.tgz

Download the Prerequisites

> cd gcc-10.2.0
> ./contrib/download_prerequisites

Make and Install

> mkdir gcc-build-10.2.0
> cd gcc-build-10.2.0
> ../configure -enable-checking=release -enable-language=c,c++ -disable-multilib
> make -j4 # for multi-core optimization
> make install
> ls /usr/local/bin | grep gcc # check whether it is installed successfully or not
 
#To restart the operation system,and then check the version. 
> gcc -v
> strings /usr/lib64/libstdc++.so.6 | grep GLIBC
# If "GLIBCXX_3.4.28" is not shown in the list, please run the following commands. 
> find / -name "libstdc++.so"
> find / -name "libgomp.so"
 
# copy the latest library
> cd /usr/lib64
> cp /root/xushuo/gcc-10.2.0/gcc-build-10.2.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so ./
> cp /root/xushuo/gcc-10.2.0/gcc-build-10.2.0/stage1-x86_64-pc-linux-gnu/libgomp/.libs/libgomp.so ./
 
# delete the old soft link and then create the new one
> rm -rf libstdc++.so.6
> rm -rf libgomp.so.1
> ln -s libstdc++.so libstdc++.so.6
> ln -s libgomp.so libgomp.so.1
 
# In this time, "GLIBCXX_3.4.28" should appear.
> strings /usr/lib64/libstdc++.so.6 | grep GLIBC
zh/notes/update_gcc.txt · 最后更改: 2022/06/30 11:28 由 pzczxs