Example of how to upgrade gcc in linux

小云云
Release: 2023-03-21 16:28:01
Original
3025 people have browsed it


The original intention of GCC was to be a compiler specially written for the GNU operating system. The GNU system is completely free software. Here, "free" means that it respects the user's freedom. This article mainly shares with you examples of how to upgrade gcc in Linux. I hope it can help you.

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
tar -jxvf gcc-4.8.2.tar.bz2
Copy after login

Create a directory for storing compiled files

mkdir gcc-build-4.8.2
cd gcc-build-4.8.2
Copy after login

Generate Makefile file

../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
Copy after login

Compile (note: this step is very time-consuming)

make -j4
Copy after login

make -j4

sudo make install
Copy after login

Restart and check the gcc version gcc -v Write a program segment test.cpp with C++11 features and use shared_ptr

//test.cpp
#include 
#include 
using namespace std;
int main()
{
      shared_ptr pInt(new int(10));
      cout < < *pInt << endl;
      return 0;
}
Copy after login

Verification

g++ -std=c++11 -o test test.cpp
./test
Copy after login

If you cannot find GLIBCXX_3.4.15 in libstdc++.so.6, please execute the following Command

cp /usr/local/lib64/libstdc++.so.6.0.18 /usr/lib64
rm -rf /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.18 /usr/lib64/libstdc++.so.6
Copy after login

to check whether the link is

ll /usr/lib64/libstdc++.so.6
lrwxrwxrwx 1 root root 19  9月 29 12:48 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.18
Copy after login

Related recommendations:

lnmp - Doubts about PHP7 GCC PGO compilation

Make your PHP 7 faster GCC PGO

linux centos5.5 cannot install gcc for some unknown reason

The above is the detailed content of Example of how to upgrade gcc in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!