Update libstdc++.so.6 Dynamic library after GCC upgrade

Source: Internet
Author: User
Tags printable characters

Talk is cheap, show me the code. I. Description of the problem

When you execute some programs, you will get an error, as follows:

./test4:/usr/lib64/libstdc++.so.6:version ' glibcxx_3.4.21 ' not found (required by./test4)
Second, the problem analysis

is the GCC version too low, so install upgrades:

SU root
yum install libstdc++.so.6

The results show:

Package libstdc++-4.4.7-17.el6.i686 already installed and latest version

To illustrate that GCC is already the latest version, then make sure that the libstdc++.so.6 in the current/usr/lib64 directory contains the dynamic library version:

strings/usr/lib64/libstdc++.so.6 | grep GLIBC

The results show:

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
glibc_ 2.2.5
glibc_2.3
glibc_2.3.2
glibcxx_debug_message_length

Found that there is indeed no version 3.4.21, it is likely that the GCC upgrade did not update the/usr/lib64 under the libstdc++.so.6 Dynamic Library, then find out where the latest libstdc++.so.6:

Find/-name libstdc++.so.6

Two suspicious directories were found:

/usr/local/lib64/libstdc++.so.6
/home/gcc-6.1.0/gcc-temp/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/ Libstdc++.so.6

Then check out the dynamic libraries in the/USR/LOCAL/LIB64 directory:

strings/usr/local/lib64/libstdc++.so.6 | grep GLIBC

The results are as follows:

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
glibcxx_3.4.20
glibcxx_3.4.21
glibcxx_3.4.22
glibc_2.3 glibc_2.2.5
glibc_2.3.2
glibcxx_force_new
glibcxx_debug_message_length

Found that this is the latest version of the dynamic library, visible, in the upgrade of GCC, GCC compilation will be in the Gcc-temp directory to generate libstdc++.so.6, upgrade completed, the default will only be in the/USR/LOCAL/LIB64 directory contains the latest libstdc++. So.6 the dynamic library without updating the libstdc++.so.6 in the/usr/lib64 directory. While executing the program, the program will take precedence from the/usr/lib64 directory to look for libstdc++.so.6, because the old version of GCC in the/usr/lib64 has an older version of the dynamic library libstdc++. So.6, causing the program to think that they found the correct dynamic library, actually found is not the latest. Third, the solution

Replace the old/usr/lib64/libstdc++.so.6 with the latest libstdc++.so.6:

cd/usr/lib64
rm-rf libstdc++.so.6
cp/usr/local/lib64/libstdc++.so.6./

Note:

The Linux strings command means reading at least 4 consecutive printable characters from a file, reading until it is not printable. For a generic plain document, strings will output the entire text content, but for binary files, the effect of strings is obvious, printing only the characters in the binary file that are consecutively tick. It uses strings to find the GLIBC version supported in the libstdc++.so.6 binaries.

String Libstdc++.so.6 | grep GLIBC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.