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

Centos6 upgrade gcc-5.4 and cmake3

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

System

# cat / etc/redhat-release CentOS release 6.8 (Final)

1. Upgrade gcc-5.4.0

Gcc version of the system before installation

# gcc-vUsing built-in specs.Target: x86_64-redhat-linuxConfigured 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-languages=c,c++,objc,obj-c++,java Fortran Ada-enable-java-awt=gtk-disable-dssi-with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre-enable-libgcj-multifile-enable-java-maintainer-mode-with-ecj-jar=/usr/share/java/eclipse-ecj.jar-disable-libjava-multilib-with-ppl-with-cloog-with-tune=generic with-arch_32=i686 build=x86_64-redhat-linuxThread model : posixgcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)

1.1 download installation package

Wget http://mirrors.nju.edu.cn/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz

The following four files are extracted to gcc-5.4.0, and the soft link is mpfr gmp mpc isl

Http://mirror.hust.edu.cn/gnu/mpfr/mpfr-2.4.2.tar.gz

Http://mirrors.nju.edu.cn/gnu/gmp/gmp-4.3.2.tar.gz

Http://mirrors.nju.edu.cn/gnu/mpc/mpc-1.1.0.tar.gz

Http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.14.tar.bz2

Or execute the following script automatically

. / contrib/download_prerequisites

1.2 compile and install

Cd.. mkdir gcc-build-5.4.0cd gcc-build-5.4.0../gcc-5.4.0/configure-- enable-checking=release-- enable-languages=c,c++-- disable-multilibmake & & make install

Gcc- v at this time, the system gcc will automatically become the gcc-5.4 version

# gcc- vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapperTarget: x86_64-unknown-linux-gnuConfigured with:.. / gcc-5.4.0/configure-- enable-checking=release-- enable-languages=c,c++-- disable-multilibThread model: posixgcc version 5.4.0 (GCC)

Add the environment variable for the new gcc: export PATH=$PATH:/usr/local/bin

Create a soft link to a new gcc: sudo ln-s / usr/local/bin/gcc / usr/bin/gcc

two。 Upgrade cmake to version 3.10

$cmake-- versioncmake version 2.8.12.2

Due to the upgrade of gcc version, the library file of glibc needs to be updated, otherwise an error will be reported.

Cp / usr/local/lib64/libstdc++.so.6.0.21 / usr/lib64mv libstdc++.so.6 libstdc++.so.6.bakln-s libstdc++.so.6.0.21 libstdc++.so.6

Compile and install cmake-3.10

. / bootstrapgmake & & gmake installyum remove cmakeln-s / usr/local/bin/cmake / usr/bin/cmakeln-s / usr/local/bin/cpack / usr/bin/cpackln-s / usr/local/bin/ctest / usr/bin/ctest

The upgraded version at this time is as follows:

# cmake-versioncmake version 3.10.0-rc4CMake suite maintained and supported by Kitware (kitware.com/cmake).

The more obvious pits are as follows:

After 1.gcc upgrade, the original glibc library will send changes

Glibc installed by yum will have libstdc++.so.6.0.13 under / usr/local/lib64 and soft connect to libstdc++.so.6

If cmake is compiled later, it will report "GLIBCXX_3.4.21' not found" when calling the libstdc++ library. If you do the following, the error will disappear if you link the libstdc++ library file under / usr/local/lib64 to / usr/lib64.

# ln-s / usr/local/lib64/libstdc++.so.6 / usr/lib64/libstdc++.so.6

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

Servers

Wechat

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

12
Report