CentOS下glibc更新

使用java -agentpath=xxx时报该错,提示glibc版本过低:version `GLIBC_2.14' not found (required by /data/jjns/UEISecurity_JVM.dll)。

查看当前glibc版本:

ll /lib64/libc.so.6
lrwxrwxrwx. 1 root root 12 Apr 14 16:14 /lib64/libc.so.6 -> libc-2.12.so

说明当前glibc版本为2.12,需要glibc2.14,于是进行glibc更新操作

1. 从glibc官网(http://ftp.gnu.org/gnu/glibc)下载源码包:glibc-2.14.tar.bz2及glibc-linuxthreads-2.5.tar.bz2。

2. 在任意目录新建文件夹,存放解压文件,例如:

mkdir /data/test

3. 进入新建的目录

cd /data/test

4. 解压源码包glibc-2.14.tar.bz2,并进入解压文件夹

tar -jxvf /home/xx/software/glibc-2.14.tar.bz2
cd glibc-2.14/

5. 解压源码包glibc-linuxthreads-2.5.tar.bz2

tar -jxvf /home/xx/software/glibc-linuxthreads-2.5.tar.bz2

6. 返回上级目录,重要

cd ..

7. 加上优化开关,否则会出现错误,必须用root用户

export CFLAGS="-g -O2"

8. 编译前配置参数

./glibc-2.14/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

9. 编译,执行很久,可能出错,出错再重新执行(我未出错)

make

10. 安装

make install

我遇到报错如下,但检查第11步显示仍然成功:

 1 Execution of gcc failed!
 2 The script has found some problems with your installation!
 3 Please read the FAQ and the README file and check the following:
 4 - Did you change the gcc specs file (necessary after upgrading from
 5   Linux libc5)?
 6 - Are there any symbolic links of the form libXXX.so to old libraries?
 7   Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
 8   libm.so should point to the newly installed glibc file - and there should be
 9   only one such link (check e.g. /lib and /usr/lib)
10 You should restart this script from your build directory after you've
11 fixed all problems!
12 Btw. the script doesn't work if you're installing GNU libc not as your
13 primary library!
14 make[1]: *** [install] Error 1
15 make[1]: Leaving directory `/usr/src/glibc'
16 make: *** [install] 错误 2

11. 检查更新后版本,显示2.14即更新成功

ll /lib64/libc.so.6
lrwxrwxrwx 1 root root 12 Jun 25 02:07 /lib64/libc.so.6 -> libc-2.14.so

参考文档:http://blog.csdn.net/rosen_luo/article/details/49450969

原文地址:https://www.cnblogs.com/juzii/p/4952250.html