Check it is actually needed
Firstly check the python application as it could be out of date and is probably misreading the glibc version. CentOS shows the base version as installed and is patched to keep up with changes and it could just be a case of fixing the version that is being looked for in the code as a quick fix, but if the application is being actively developed you need to let the developers know or fork it for yourself if you can.
An up to date glibc on CentOS 7 should be 2.17-196.el7_4.2
If it is needed, Containerise
If it's absolutely necessary to run this application, the official RHEL approach would be to containerize, but you would still need to provide a working glibc, which wouldn't be possible with stock CentOS 7.
As a last resort, install glibc in a nonstandard location
If this isn't viable, and as an absolute last resort, it is possible to install a newer version of glibc than 2.18 as that is 9 years old now and glibc has been updated for several vulnerabilities and I'm not sure off the top of my head if it will build with the version of make in CentOS 7, but any newer version should work as follows:
- This can potentially affect the functionality of your computer so make sure you know what you are doing
You can build the version of glibc you require elsewhere on your server and add it to LD_LIBRARY_PATH for the application. Note this must only be done for the application only.
wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
Then to run a binary you need to use patchelf to update its interpreter
patchelf --set-interpreter /opt/glibc-2.18/lib/ld-linux-x86-64.so.2 program_you_are_running
And you need to enable it to find the new glibc library, either by
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
Or you can use patchelf to update the binary's rpath (you can combine this with the previous pathelf command)
patchelf --set-rpath /opt/glibc-2.18/lib:/usr/lib64 program_you_are_running
If you change LD_LIBRARY_PATH don't export it for the whole system because all the binaries unmodified by patchelf will segfault.
/opt is the standard place to install third-party applications and libraries but you can use any path away from the system paths.
Check it is actually needed
Firstly check the python application as it could be out of date and is probably misreading the glibc version. CentOS shows the base version as installed and is patched to keep up with changes and it could just be a case of fixing the version that is being looked for in the code as a quick fix, but if the application is being actively developed you need to let the developers know or fork it for yourself if you can.
An up to date glibc on CentOS 7 should be 2.17-196.el7_4.2
If it is needed, Containerise
If it's absolutely necessary to run this application, the official RHEL approach would be to containerize, but you would still need to provide a working glibc, which wouldn't be possible with stock CentOS 7.
As a last resort, install glibc in a nonstandard location
If this isn't viable, and as an absolute last resort, it is possible to install a newer version of glibc than 2.18 as that is 9 years old now and glibc has been updated for several vulnerabilities and I'm not sure off the top of my head if it will build with the version of make in CentOS 7, but any newer version should work as follows:
- This can potentially affect the functionality of your computer so make sure you know what you are doing
You can build the version of glibc you require elsewhere on your server and add it to LD_LIBRARY_PATH for the application. Note this must only be done for the application only.
wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
Then to run a binary you need to use patchelf to update its interpreter
patchelf --set-interpreter /opt/glibc-2.18/lib/ld-linux-x86-64.so.2 program_you_are_running
And you need to enable it to find the new glibc library, either by
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
Or you can use patchelf to update the binary's rpath (you can combine this with the previous pathelf command)
patchelf --set-rpath /opt/glibc-2.18/lib:/usr/lib64 program_you_are_running
If you change LD_LIBRARY_PATH don't export it for the whole system because all the binaries unmodified by patchelf will segfault.
/opt is the standard place to install third-party applications and libraries but you can use any path away from the system paths.
In the end,I did not have to upgrade GLIBC. The gdc-client tool I downloaded through R seemed to be for Ubuntu and not CentOS, though I did it on CentOS 7. I then downloaded the gdc-client for CentOS and it worked fine.
Am I doing things wrong, or is CentOS 7's GLIBC really old?
centos7 - Upgrade glibc 2.17 to 2.19+ on CentOS 7 - Stack Overflow
Chrome 95 on CentOS 7.9 - Unix & Linux Stack Exchange
linux - Building and using a newer GLIBC on CentOS 7 - Stack Overflow
I am trying to run an executable that is an official binary release from an open-source project, but I get the dreaded
> version `GLIBCXX_3.4.20' not found
The machine is running CentOS 7.6.1810, but when I do a
> strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
it only goes up to GLIBCXX_3.4.19.
Isn't that a really old glibc version? This site ( https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html ) suggests GLIBCXX_3.4.19 corresponds to GCC 4.8.3, which was released in 2014.
You need to download the following 4 packages from a mirror:
- glibc-2.17-55.el7.i686.rpm
- glibc-2.17-55.el7.x86_64.rpm
- glibc-common-2.17-55.el7.x86_64.rpm
- glibc-headers-2.17-55.el7.x86_64.rpm
After doing so, issue a rpm -ivh glibc-*. If that fails, download:
- glibc-devel-2.17-55.el7.i686.rpm
- glibc-devel-2.17-55.el7.x86_64.rpm
and reissue the command again. After getting glibc updated, issue a yum update to resolve any new dependencies.
If you have glibc 2.12 installed, you do NOT have CentOS7; you're on CentOS6. While there's been a lot of grief about the locking of major/minor versions after distro release - it's for stability, testing and certification; you'll learn the value later - the version you're looking at should not exist under an up-to-date centos7.
Update your CentOS7, do a yum install of apr (apr-devel too?) and you're done.
If you DO have CentOS6, apr-1.3.9-5.el6_2.x86_64 requires glibc-2.12 . Yum install will get you what you need here, as well.
In general
- Don't mix RPMs from alient repositories: you're looking for pain.
- Don't mix RPMs from two different distro releases -- they're designed to work together, and tested so.
- if it's suddenly hard, or there are strange messages, there's a really good chance you're doing something you should not.
- Dependency Hell [tm] is self-inflicted. No exceptions.
I worked at a distro; not in Support but adjacent to it. #4 is a well-tested theory.
Try export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
1. prepare
sudo yum provides libstdc++.so.6
2. download new version libstdc.so
NOTICE: Since I need version 3.4.22+, so I can just update it to 3.4.26. Other versions are the same.
cd /usr/local/lib64
sudo wget http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip
unzip libstdc.so_.6.0.26.zip
cp libstdc++.so.6.0.26 /usr/lib64
cd /usr/lib64
3. Check the soft link version of libstdc++.so.6
ls -l | grep libstdc++
It may shows like this:
libstdc++.so.6 ->libstdc++.so.6.0.19
4. Remove /usr/lib64 original link libstdc++.so.6, you can backup it before remove.
sudo rm libstdc++.so.6
then, relink it.
sudo ln -s libstdc++.so.6.0.26 libstdc++.so.6
OK, check the newest link
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
It may shows like this:
GLIBCXX_3.4
…
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_DEBUG_MESSAGE_LENGTH
Done!
DistroWatch typically has a pretty good run down of what each distro has.
Red Hat's run down
Edit: The RedHat documentation used to list the version of the libraries they included. They have since removed that information.
This data is from distrowatch. Sorry for the sideways scroll and long ASCII text. StackOverflow doesn't support Markdown Tables.
| Package | RHEL-8.4 | RHEL-7.9 | RHEL-6.9 | RHEL-5.11 | RHEL-4.8 | RHEL-3.9 | RHEL-2.1 | 9 | 8.0 | 7.3 | 7.2 | 7.1 | 7.0 | 6.2 | 6.1 | 6.0 | 5.2 | 5.1 | 5.0 | 4.2 |
| | | | | | | | | shrike | psyche | valhalla | enigma | seawolf | guiness | zoot | cartman | hedwig | apollo | manhattan | hurricane | biltmore |
| glibc (2.34) | 2.28 | 2.17 | 2.12 | 2.5 | 2.3.4 | 2.3.2 | 2.2.4 | 2.3.2 | 2.2.93 | 2.2.5 | 2.2.4 | 2.2.2 | 2.1.92 | 2.1.3 | 2.1.2 | 2.1.1 | 2.0.7 | 2.0.7 | 2.0.5c | -- |
It used to be available from RedHat documentation: RHEL 6 RHEL 7