如下在系統CentOS 6.3 x86_64上操做ios
1.試圖運行程序,提示"libc.so.6: version `GLIBC_2.14' not found",緣由是系統的glibc版本過低,軟件編譯時使用了較高版本的glibc引發的:redis
[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支持的版本:app
[work@zc-mc-face01 src]$ 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
[work@zc-mc-face01 src]$ rpm -qa | grep glibc glibc-common-2.12-1.80.el6_3.6.x86_64 glibc-2.12-1.80.el6_3.6.x86_64 glibc-headers-2.12-1.80.el6_3.6.x86_64 glibc-devel-2.12-1.80.el6_3.6.x86_64
3.能夠看到當前系統最高只支持2.12版本,因此須要安裝新版原本解決這個問題:socket
編譯安裝步驟以下:ui
a. 到http://www.gnu.org/software/libc/下載最新版本,我這裏下載了glibc-2.14.tar.gz 這個版本,解壓到任意目錄準備編譯this
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
b.這裏解壓到~/glibc-2.14/ spa
[work@zc-mc-face01 src]# cd /home/work/glibc-2.14/ [work@zc-mc-face01 glibc-2.14]# ls BUGS ChangeLog.2 NAMESPACE bits elf libidn po string CANCEL-FCT-WAIVE ChangeLog.3 NEWS build extra-lib.mk libio posix sunrpc CANCEL-FILE-WAIVE ChangeLog.4 NOTES catgets extra-modules.mk locale pwd sysdeps CONFORMANCE ChangeLog.5 PROJECTS conf gmon localedata resolv sysvipc COPYING ChangeLog.6 README config.h.in gnulib login resource termios COPYING.LIB ChangeLog.7 README.libm config.make.in grp mach rt test-skeleton.c ChangeLog ChangeLog.8 Rules configure gshadow malloc scripts time ChangeLog.1 ChangeLog.9 Versions.def configure.in hesiod manual setjmp timezone ChangeLog.10 FAQ WUR-REPORT conform hurd math shadow tls.make.c ChangeLog.11 FAQ.in abi-tags cppflags-iterator.mk iconv misc shlib-versions version.h ChangeLog.12 INSTALL abilist crypt iconvdata nis signal wcsmbs ChangeLog.13 LICENSES aclocal.m4 csu include nptl socket wctype ChangeLog.14 Makeconfig aout ctype inet nptl_db soft-fp ChangeLog.15 Makefile argp debug intl nscd stdio-common ChangeLog.16 Makefile.in assert dirent io nss stdlib ChangeLog.17 Makerules autom4te.cache dlfcn libc-abis o-iterator.mk streams
c.在glibc源碼目錄創建構建目錄,並cd進入構建目錄debug
[work@zc-mc-face01 glibc-2.14]# mkdir build [work@zc-mc-face01 glibc-2.14]# cd build
d.運行configure配置,make && sudo make installcode
1. [work@zc-mc-face01 build]# ../configure --prefix=/opt/glibc-2.14
這一步若是config失敗,顯示錯誤以下:orm
checking whether ranlib is necessary... no checking LD_LIBRARY_PATH variable... contains current directory configure: error: *** LD_LIBRARY_PATH shouldn't 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 -j4 3. [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