升级gcc,glibc库途中遇到的各种问题

本文详细记录了在Redhat系统中升级gcc到4.8.3和glibc到2.19的过程中遇到的配置错误,包括gcc依赖包问题、LD_LIBRARY_PATH设置、<cpuid.h>头文件缺失以及kernel header文件版本不足等,并提供了相应的解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在互联网的世界中,总是会让人有种“山重水复疑无路,柳暗花明又一村”。在经过诸多问题后,在这个共享的世界里,找到了解决方法,具体细节在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安装
原以为和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

解压:

[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终于安装成功




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值