標籤:style blog http color io os 使用 ar for
以下在系統CentOS 6.3 x86_64上操作
1.試圖運行程式,提示"libc.so.6: version `GLIBC_2.14‘ not found",原因是系統的glibc版本太低,軟體編譯時間使用了較高版本的glibc引起的:
[[email protected] src]$ ./redis-server ./redis-server: /lib64/libc.so.6: version `GLIBC_2.14‘ not found (required by ./redis-server)
2.查看系統glibc支援的版本:
[[email protected] 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
[wo[email protected] 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/
[[email protected] src]# cd /home/work/glibc-2.14/[[email protected]-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進入構建目錄
[[email protected] glibc-2.14]# mkdir build[[email protected]-mc-face01 glibc-2.14]# cd build
d.運行configure配置,make && sudo make install
1. [[email protected] 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 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. [[email protected] build]# make -j43. [[email protected] build]# sudo make install
4.臨時修改環境變數
[[email protected] build]# export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH
5.接下來就可以正常啟動redis了
[[email protected] build]# cd ~/app/redis-2.8.13/src[[email protected]-mc-face01 src]# ./redis-server
CentOS 安裝redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系統的glibc版本太低