Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method for Linux to upgrade gcc

2025-04-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "what is the method of Linux upgrading gcc", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the method of upgrading gcc by Linux"?

1. View the current * RHEL/C**entos*** version:

[root@linuxprobe ~] # cat / etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) 2. View the existing gcc version:

[root@linuxprobe] # gcc-- version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [root@linuxprobe] # gcc-v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper Target: x86_64-redhat-linux Configured with:.. / configure-- prefix=/usr-- mandir=/usr/share/man-- infodir=/usr/share/info-- with-bugurl= http://bugzilla.redhat.com/bugzilla-- enable-bootstrap-- enable-shared-- enable-threads=posix-- enable-checking=release-- with-system-zlib-- enable-__ Cxa_atexit-disable-libunwind-exceptions-enable-gnu-unique-object-enable-linker-build-id-with-linker-hash-style=gnu-enable-languages=c OBJC, objlic, caterpillar, java, fortran, ADA, go. Lto-enable-plugin-enable-initfini-array-disable-libgcj-with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install-with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install-enable-gnu-indirect-function-with-tune=generic-with-arch_32=x86 64-build=x86_64-redhat-linux Thread model: posix gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) [root@linuxprobe] # gcc-version

3. Install * RHEL/C**entos**7* default development tools, including gcc,g++,make and other tools:

[root@linuxprobe ~] # yum groupinstall "Development Tools" * 4, * View the default dynamic library:

[root@linuxprobe ~] # strings / usr/lib64/libstdc++.so.6 | grep GLIBC GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3 .4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBC_2.3 GLIBC_2.2.5 GLIBC_2.14 GLIBC_2.4 GLIBC_2.3.2 GLIBCXX_DEBUG_MESSAGE_ linuxprobe [root @ root ~] # strings / usr/lib64/libstdc++.so.6 | grep

5. Obtain the installation package and decompress it:

[root@linuxprobe ~] # cd / usr/local/src/ [root@linuxprobe src] # wget http://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz [root@linuxprobe src] # tar xvf gcc-7.3.0.tar.xz 6. Install the dependent software of gcc. The script *. / contrib/download_prerequisites* that automatically downloads the required software is provided in the package of gcc. * this magical script file will help us download, configure and install dependent libraries, which can save us a lot of time and energy *:

[root@linuxprobe src] # cd gcc-7.3.0/ [root@linuxprobe gcc-7.3.0] #. / contrib/download_prerequisites 7. Generate Makefile file:

[root@linuxprobe gcc-7.3.0] #. / configure-enable-checking=release-enable-languages=c,c++-disable-multilib 8, compile gcc:

[root@linuxprobe gcc-7.3.0] # make-J4 / / multicore computers can add "- J4": make's optimization option for multicore processors. This step is very time-consuming [root@linuxprobe gcc-7.3.0] # ls / usr/local/bin | grep gcc 9. Install gcc:

[root@linuxprobe gcc-7.3.0] # make install 10. Configure gcc:

[root@linuxprobe gcc-7.3.0] # cd ~ [root@linuxprobe ~] # find / usr/local/src/gcc-7.3.0/-name "libstdc++.so*" / usr/local/src/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24 / usr/local/src/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/ Libstdc++-v3/src/.libs/libstdc++.so.6 / usr/local/src/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so / usr/local/src/gcc-7.3.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24 / usr/local/src/gcc-7.3.0/prev-x86_64-pc -linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 / usr/local/src/gcc-7.3.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so / usr/local/src/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24 / usr/local/src/gcc-7.3.0/x86_64- Pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 / usr/local/src/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so [root@linuxprobe ~] # cd / usr/lib64 [root@linuxprobe lib64] # cp / usr/local/src/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24. [root@linuxprobe lib64] # mv libstdc++.so.6 libstdc++.so.6.old [root@linuxprobe lib64] # ln-sv libstdc++.so.6.0.22 libstdc++.so.6' libstdc++.so.6'-> 'libstdc++.so.6.0.22' here, I believe you have a better understanding of "what is the method of Linux upgrading gcc". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report