1、centos5.2 上安装 gcc 步骤,以及 cannot create executablesCentOS5.2系统安装在虚拟机上,编译 gcc.挂载 CentOS 的 DVD 系统光盘,然后进入 CentOS 目录内,安装顺序如下 :rpm -ivh cpp-4.1.2-42.el5.i386.rpmrpm -ihv kernel-headers-2.6.18-92.el5.i386.rpmrpm -ivh glibc-headers-2.5-24.i386.rpmrpm -ivh glibc-devel-2.5-24.i386.rpmrpm -ivh libgomp-4.1.2-42.
2、el5.i386.rpmrpm -ivh gcc-4.1.2-42.el5.i386.rpm注意:必须安装: kernel-headers-2.6.18-92.el5.i386.rpm 这个包,否则报错:warning: glibc-headers-2.5-24.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897error: Failed dependencies:kernel-headers is needed by glibc-headers-2.5-24.i386kernel-headers = 2.2.1 is neede
3、d by glibc-headers-2.5-24.i386安装:g+rpm -ihv libstdc+-devel-4.1.2-42.el5.i386.rpmrpm -ihv gcc-c+-4.1.2-42.el5.i386.rpm卸载 apache 相关:rpm -e -nodeps httpd-2.2.3-11.el5_1.centos.3rpm -e system-config-httpd-1.3.3.3-1.el5rpm -e httpd-manual-2.2.3-11.el5_1.centos.3强制安装:-force强制卸载 -nodepslibtool:rpm -ihv ima
4、ke-1.0.2-3.i386.rpmrpm -ihv imake-1.0.2-3.i386.rpmrpm -ihv automake-1.9.6-2.1.noarch.rpmrpm -ihv libobjc-4.1.2-42.el5.i386.rpmrpm -ihv gcc-objc-4.1.2-42.el5.i386.rpmrpm -ihv gcc-objc-4.1.2-42.el5.i386.rpm错误:checking for C compiler default output. configure: error: C compiler cannot create executable
5、s原因:/etc/yum.conf 它已经配置好了相关的库和路径等等的依赖性!解决:yum install libc6-devyum clean headersyum clean packages我在网上看到有人说要下一个 LIBC6DEV 的包,我用 YUM 试了一下,下不到这个包,我看了上面既然是 c+的问题,那我就下一个 gcc-c+看看yum install gcc-c+刚好操下命令后,它自动的帮我下了两个软件gcc-c+libstc+下好以后就这样完全通过了?那就接着试试:yum install glibc-devel-X.X.X-XXsudo yum install qt4-dev
6、el curl-devel gcc glibc-devel2yum install glibc-devel升级:rpm -Uvh *.rpm应该就是下面的那些包,不行再 reinstall 一次看看:2.5u# rpm -Uvh *.rpmPreparing. # 100%1:libgcc # 6%2:glibc-common # 12%3:glibc # 18%4:binutils # 24%5:glibc-headers # 29%6:glibc-devel # 35%7:libstdc+ # 41%8:libstdc+-devel # 47%9:apr # 53%10:cpp # 59%
7、11:libgomp # 65%12:gcc # 71%13:apr-devel # 76%14:binutils-devel # 82%15:gcc-c+ # 88%16:glibc-utils # 94%17:libtool # 100%最后,还是发现 cannot create executables,等等,最后进过比对后发现我的 rpm 包和系统运维的 rpm 包一个是 CentOS-5.2-i386-bin-DVD.iso,另 外一个是:CentOS-5.2-x86_64-bin-DVD.iso,我的是 CentOS-5.2-i386-bin-DVD.iso,我 倒。 。 。! !请参考我如何发现系统不同的这篇文章:http:/www.xiangdong.org/blog/post/1503/,笑死我也。 。 。结束:查正得出:x86-64系统可以运行 i386软件。只有你编译什么东西就在什么东西的连接选项上添加-march=i386 -m32,如:gcc a.c -march=i386 -m32 你也可以加到 Makefile里面。