Centos6.X升级glibc解决“libc.so.6 version GLIBC_2.14 not found”报错问题

注意:升级glibc时必需双开或是多开ssh终端

程序运行没有找到“GLIBC_2.14”这个版本库,而默认的Centos6.5 glibc版本最高为2.12, 所以需要更新系统glibc库

解决办法:
1.查看系统版本和glibc库版本
# cat /etc/redhat-release
CentOS release 6.5

# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE

信息可以看出系统是CentOS 6.5,最高支持glibc的版本为2.12,而研发程序要2.14版本,所以需要升级。

2.下载软件并升级:

# wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
# wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.14.tar.gz
tar -xvf glibc-2.14.tar.gz
tar -xvf glibc-ports-2.14.tar.gz
mv glibc-ports-2.14 glibc-2.14/ports
mkdir glibc-build-2.14
cd glibc-build-2.14/
../glibc-2.14/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# make
# make install

注意:当make成功后,会在当前glibc-build-2.14目录下生成一个新的libc.so.6的软连接,指向的是本目录下的libc.so文件

# ll glibc-build-2.14/libc.so.6
glibc-build-2.14/libc.so.6 -> libc.so

3.再次查看glibc支持的版本:
# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_PRIVATE

====================================================

扩展阅读:

我遇到报错如下
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
libm.so should point to the newly installed glibc file - and there should be
only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [install] Error 1
make[1]: Leaving directory `/opt/glibc-2.14'
make: *** [install] 错误 2

检查更新后版本,显示2.14即更新成功
ll /lib64/libc.so.6
lrwxrwxrwx 1 root root 12 Jun 25 02:07 /lib64/libc.so.6 -> libc-2.14.so

==================================

ls: /usr/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /lib64/librt.so.1)
ls: /usr/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /lib64/libpthread.so.0)

1、删除原来软链 //谨慎操作后不要乱动
rm -rf /lib64/libc.so.6 //谨慎操作后不要乱动

2、解决补救问题
LD_PRELOAD=/lib64/libc-2.14.so ln -s /lib64/libc-2.14.so /lib64/libc.so.6
因为操作删除软链接后系统无法操作任何命令,我们需要复制上命令操作后才可以。(要谨慎)

3、创建新软链接
ln -s /lib64/libc-2.14.so /lib64/libc.so.6

猜你喜欢

转载自www.cnblogs.com/hacker1394/p/10201486.html