How to point to the newer version of gcc libs when

2019-09-15 09:53发布

问题:

I am trying to install Chrome on my Centos 6.4. The stock gcc is 4.4.6, so I installed 4.7.3 in /opt/gcc-4.7.3 myself. Also added /opt/gcc-4.7.3/bin to PATH and prepended /opt/gcc-4.7.3/lib64 to LD_LIBRARY_PATH where libstdc++.so.6 is located. However when I install chrome rpm, still got the same error:

rpm -ivh google-chrome-stable_current_x86_64.rpm 
warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
    libstdc++.so.6(GLIBCXX_3.4.15)(64bit) is needed by google-chrome-stable-34.0.1847.132-1.x86_64

It clearly shows that GLIBCXX_3.4.15 is there:

/opt/gcc-4.7.3/lib64/libstdc++.so.6 | grep GLIBCXX
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_FORCE_NEW
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

How do I force installer to look at the newer version libstdc++.so.6?

回答1:

RPM only knows about software installed by RPM and registered in the RPMDB. Installing other versions of software in arbitrary locations doesn't mean RPM knows about it.

Your options are to install a newer GCC via RPM or install chrome using the --nodeps option, which tells RPM not to check dependencies. If you choose the second approach then it's your responsibility to make sure the libraries will be found at runtime, e.g. by setting LD_LIBRARY_PATH or some other method such as adding the directory to the ldconfig cache.