天天看點

更新gcc,glibc庫途中遇到的各種問題

在網際網路的世界中,總是會讓人有種“山重水複疑無路,柳暗花明又一村”。在經過諸多問題後,在這個共享的世界裡,找到了解決方法,具體細節在Redhat更新gcc-4.8.3 Redhat5中glibc2.5更新到glibc2.9

這裡隻是對安裝過程的簡單彙總:

1.安裝gcc-4.8.3

在所有準備工作(下載下傳、解壓)都做好後,進行編譯就出現了3個關聯包得問題

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.
           

錯誤提示需要先安裝GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.

由于MPFR 2.4.0+包的安裝依賴于GMP 4.2+,而 and MPC 0.8.0+包的安裝依賴于GMP 4.2+, MPFR 2.4.0+ .。是以需要先安裝GMP 4.2再安裝 MPFR 2.4.0最後安裝MPC 0.8.0

1)GMP的安裝

[[email protected] gmp-4.3.2]# ./configure 
[[email protected] gmp-4.3.2]# make 
[[email protected] gmp-4.3.2]# make install 
           

這三步順利安裝,沒有一點問題。

2)MOFR安裝

原以為和GMP安裝相似,用同樣的方法安裝出現錯誤

configure: WARNING: 'gmp.h' and 'libgmp' seems to have different versions or
configure: WARNING: we cannot run a program linked with GMP (if you cannot
configure: WARNING: see the version numbers above).
configure: WARNING: However since we can't use 'libtool' inside the configure,
configure: WARNING: we can't be sure. See 'config.log' for details.
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating mparam.h
config.status: executing depfiles commands
config.status: executing libtool commands
           

configure配置就出現的堆警告,make直接報錯

解決方法:

配置時添加上,依賴關系:

configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2
           

注:--prefix  為安裝路徑   --with   依賴包連結

3)MPFR安裝

出現問題與MOFR安裝出現問題,類似都是沒有添加依賴包

解決方法:

/configure --prefix=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2
           

2.安裝glibc

在安裝qt4.8是出現依賴包得缺失問題,在網上搜尋得知,是由于glibc版本過低(主機glibc版本 glibc-2.5-42)。

是以就打算更新glibc下載下傳安裝glibc-2.19

解壓:

[[email protected] opt]# tar -zxvfglibc-2.19.tar.gz

[[email protected] glibc-2.19]# exportCFLAGS="-g -O2 -march=i686" 

錯誤一

配置: 

[[email protected] glibc-build]# ../configure--prefix=/usr/local/glibc-2.19

錯誤提示:

configure: error:

*** These critical programs are missing ortoo old: as ld gcc

*** Check the INSTALL file for requiredversions.

解決方法:

(錯誤原因查不到,自以為是gcc版本低,glibc版本高,使用較低的gblic,最笨的方法)

錯誤二(安裝glibc-2.11.1)

解壓:

[[email protected] glibc-build]# tar -jxvf glibc-2.11.1.tar.bz2

配置:

./configure --prefix=/usr/local/glibc-2.11.1

錯誤提示一

l  *** LD_LIBRARY_PATH shouldn't contain the current directory when

*** building glibc. Please change theenvironment variable

*** and run configure again.

解決方法:

删除LD_LIBRARY_PATH變量的内容

[[email protected] glibc-build]# echo $LD_LIBRARY_PATH

:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/gcc-4.8.3/lib

 [[email protected] glibc-build]# LD_LIBRARY_PATH=

錯誤提示二

l  cnfigure: error:gcc must provide the <cpuid.h> header

[[email protected] glibc-build]#

解決方法:

指定<cpuid.h>檔案--with-headers=/usr/include

[[email protected] glibc-build]# ../configure  --prefix=/usr/local/glibc-2.11.1--with-headers=/usr/include

錯誤提示三

l  configure: error: GNU libc requires kernel headerfiles from

Linux 2.0.10 or later to be installed before configuring.

The kernel header files are found usually in /usr/include/asm and

/usr/include/linux; make sure these directories use files from

Linux 2.0.10 or later.  Thischeck uses <linux/version.h>, so

make sure that file was built correctly when installing the kernelheader

files.  To use kernel headers notfrom /usr/include/linux, use the

configure option --with-headers.

解決方法:

(目前不清楚,這個是大多數gblic安裝出錯的最根本問題)

最後下載下傳了glibc-2.9終于安裝成功

繼續閱讀