在互联网的世界中,总是会让人有种“山重水复疑无路,柳暗花明又一村”。在经过诸多问题后,在这个共享的世界里,找到了解决方法,具体细节在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的安装
[root@localhost gmp-4.3.2]# ./configure
[root@localhost gmp-4.3.2]# make
[root@localhost gmp-4.3.2]# make install
这三步顺利安装,没有一点问题。
2)MOFR安装
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安装
/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
解压:
[root@localhost opt]# tar -zxvfglibc-2.19.tar.gz
[root@localhost glibc-2.19]# exportCFLAGS="-g -O2 -march=i686"
错误一
配置:
[root@localhost 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)
[root@localhost 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变量的内容
[root@localhost 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
[root@localhost glibc-build]# LD_LIBRARY_PATH=
错误提示二
l cnfigure: error:gcc must provide the <cpuid.h> header
[root@localhost glibc-build]#
解决方法:
指定<cpuid.h>文件--with-headers=/usr/include
[root@localhost 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终于安装成功