首页 > 代码库 > CentOS 安装redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低

CentOS 安装redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低

以下在系统CentOS 6.3 x86_64上操作

1.试图运行程序,提示"libc.so.6: version `GLIBC_2.14‘ not found",原因是系统的glibc版本太低,软件编译时使用了较高版本的glibc引起的:

[work@zc-mc-face01 src]$ ./redis-server ./redis-server: /lib64/libc.so.6: version `GLIBC_2.14 not found (required by ./redis-server)

2.查看系统glibc支持的版本:

[work@zc-mc-face01 src]$ strings /lib64/libc.so.6 | grep GLIBC_GLIBC_2.2.5GLIBC_2.2.6GLIBC_2.3GLIBC_2.3.2GLIBC_2.3.3GLIBC_2.3.4GLIBC_2.4GLIBC_2.5GLIBC_2.6GLIBC_2.7GLIBC_2.8GLIBC_2.9GLIBC_2.10GLIBC_2.11GLIBC_2.12GLIBC_PRIVATE
[work@zc-mc-face01 src]$ rpm -qa | grep glibcglibc-common-2.12-1.80.el6_3.6.x86_64glibc-2.12-1.80.el6_3.6.x86_64glibc-headers-2.12-1.80.el6_3.6.x86_64glibc-devel-2.12-1.80.el6_3.6.x86_64

3.可以看到当前系统最高只支持2.12版本,所以需要安装新版本来解决这个问题:

 编译安装步骤如下:

       a. 到http://www.gnu.org/software/libc/下载最新版本,我这里下载了glibc-2.14.tar.xz 这个版本,解压到任意目录准备编译

wget http://ftp.gnu.org/gnu/glibc/glibc-2.4.tar.gz

       b.这里解压到~/glibc-2.14/  

[work@zc-mc-face01 src]# cd /home/work/glibc-2.14/[work@zc-mc-face01 glibc-2.14]# lsBUGS               ChangeLog.2  NAMESPACE       bits                  elf               libidn         po              stringCANCEL-FCT-WAIVE   ChangeLog.3  NEWS            build                 extra-lib.mk      libio          posix           sunrpcCANCEL-FILE-WAIVE  ChangeLog.4  NOTES           catgets               extra-modules.mk  locale         pwd             sysdepsCONFORMANCE        ChangeLog.5  PROJECTS        conf                  gmon              localedata     resolv          sysvipcCOPYING            ChangeLog.6  README          config.h.in           gnulib            login          resource        termiosCOPYING.LIB        ChangeLog.7  README.libm     config.make.in        grp               mach           rt              test-skeleton.cChangeLog          ChangeLog.8  Rules           configure             gshadow           malloc         scripts         timeChangeLog.1        ChangeLog.9  Versions.def    configure.in          hesiod            manual         setjmp          timezoneChangeLog.10       FAQ          WUR-REPORT      conform               hurd              math           shadow          tls.make.cChangeLog.11       FAQ.in       abi-tags        cppflags-iterator.mk  iconv             misc           shlib-versions  version.hChangeLog.12       INSTALL      abilist         crypt                 iconvdata         nis            signal          wcsmbsChangeLog.13       LICENSES     aclocal.m4      csu                   include           nptl           socket          wctypeChangeLog.14       Makeconfig   aout            ctype                 inet              nptl_db        soft-fpChangeLog.15       Makefile     argp            debug                 intl              nscd           stdio-commonChangeLog.16       Makefile.in  assert          dirent                io                nss            stdlibChangeLog.17       Makerules    autom4te.cache  dlfcn                 libc-abis         o-iterator.mk  streams

      c.在glibc源码目录建立构建目录,并cd进入构建目录

[work@zc-mc-face01 glibc-2.14]# mkdir build[work@zc-mc-face01 glibc-2.14]# cd build

    d.运行configure配置,make && sudo  make install

1. [work@zc-mc-face01 build]# ../configure --prefix=/opt/glibc-2.14

  这一步如果config失败,显示错误如下:

checking whether ranlib is necessary... nochecking LD_LIBRARY_PATH variable... contains current directoryconfigure: error:*** LD_LIBRARY_PATH shouldnt contain the current directory when*** building glibc. Please change the environment variable*** and run configure again.

  此时首先查看LD_LIBRARY_PATH:

echo $LD_LIBRARY_PATH
/opt/soft/jdk/jre/lib/amd64/server:

  而实际上这个路径的设置是有限制的:

# Test if LD_LIBRARY_PATH contains the notation for the current directory# since this would lead to problems installing/building glibc.# LD_LIBRARY_PATH contains the current directory if one of the following# is true:# - one of the terminals (":" and ";") is the first or last sign# - two terminals occur directly after each other# - the path contains an element with a dot in it

   所以这里我们只需要去掉 LD_LIBRARY_PATH 最后的那个路径分隔符‘:‘即可:

export LD_LIBRARY_PATH=/opt/soft/jdk/jre/lib/amd64/server

  接下来继续运行

2. [work@zc-mc-face01 build]# make -j43. [work@zc-mc-face01 build]# sudo make install

4.临时修改环境变量

[work@zc-mc-face01 build]# export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH

5.接下来就可以正常启动redis了

[work@zc-mc-face01 build]# cd ~/app/redis-2.8.13/src[work@zc-mc-face01 src]# ./redis-server 

CentOS 安装redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低