glibc的安裝編譯 --完整處理問題版

因爲其餘軟件須要更高級的glibc 因此升級以下: linux

首先用centos的yum升級glibc庫 centos

  • yum update glibc ide

但問題依舊。用命令查看glibc庫的信息 優化

  • rpm -qi glibc ui

顯示系統的glibc庫版本爲2.5 spa

在CentOS中用更新命令到2.5已是最新版本了,只好手動下載 glibc 2.11的源碼包編譯安裝更新: ci

地址:http://ftp.gnu.org/pub/gnu/glibc/glibc-2.11.tar.gz get


  • cd /usr/src  源碼

  • mkdir glibc-2.11-build  qt

  • wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.11.tar.gz 

  • tar zxvf glibc-2.11.tar.gz 

  • cd /usr/src/glibc-2.11-build/ 

  • export CFLAGS="-g -O2 -march=i686" 網上有些地方加優化開關 -O2  時(大寫字母O),寫的是 -02 (數字零),因此拷貝過來仍然出現3中的錯誤,因此請注意。

  • /usr/src/glibc-2.11/configure --prefix=/usr/src/glibc-2.11-build/ --with-headers=/usr/include

  • make 

  • make install

注意:

1.   在目錄usr/src/glibc-2.11執行configure命令時不能執行,需在外部文件夾glibc-2.11-build 執行

2.   加上優化開關,export CFLAGS="-g -O2 -march=i686",不然會出現錯誤,此處的i686請參照本身的機器

3.    當有以下錯誤時:

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,個人打印的是/usr/lib/qt44/lib:

configure裏說:LD_LIBRARY_PATH不能以終結符做爲開始和最後一個字符,不能有2個終結符連在一塊兒,因此修改下LD_LIBRARY_PATH便可,export LD_LIBRARY_PATH=/usr/lib/qt44/lib

4.   當有以下錯誤時:

configure: error: gcc must provide the  header

解決辦法:get the cpuid.h file from official GCC respositories> (http://gcc.gnu.org/viewcvs/gcc/tags/GC_4_14/boehm-gc/)> and put it into /usr/include(上面指定的--with-headers)   「locate cpuid」,其中能夠發現「/usr/lib/gcc/i686-redhat-linux/4.7.0/include/cpuid.h」。打開該文件

5.   當以上問題都解決時,make  make install吧,因爲東西比較多,須要些時間,大概半小時左右。

相關文章
相關標籤/搜索