checking for C++ compiler default output... configure: error: C++ compiler cannot create executable

来源:互联网 发布:淘宝企业店铺经营类型 编辑:程序博客网 时间:2024/06/11 01:34
今天编译一个C++程序遇到问题如下:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking for C++ compiler default output... configure: error: C++ compiler cannot create executable


检查config.log,发现错误如下


g++: command not found


于是,通过yum list命令查找g++的包:
[root@localhost tahoe]# yum list | grep c++
libstdc++.i386                           4.1.2-51.el5                  installed
ImageMagick-c++.i386                     6.2.8.0-15.el5_8              base     
ImageMagick-c++-devel.i386               6.2.8.0-15.el5_8              base     
compat-gcc-34-c++.i386                   3.4.6-4.1                     base     
compat-libstdc++-296.i386                2.96-138                      base     
compat-libstdc++-33.i386                 3.2.3-61                      base     
gcc-c++.i386                             4.1.2-54.el5                  base     
gcc-objc++.i386                          4.1.2-54.el5                  base     
gcc44-c++.i386                           4.4.7-1.el5                   base     
libstdc++.i386                           4.1.2-54.el5                  base     
libstdc++-devel.i386                     4.1.2-54.el5                  base     
libstdc++44-devel.i386                   4.4.7-1.el5                   base     
xmlrpc-c-c++.i386                        1.16.24-1206.1840.4.el5       base   


通过yum命令安装
[root@localhost]# yum install gcc-c++.i386
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.usonyx.net
 * extras: mirror.usonyx.net
 * updates: ftp.swin.edu.au
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.i386 0:4.1.2-54.el5 set to be updated
--> Processing Dependency: libstdc++ = 4.1.2-54.el5 for package: gcc-c++
--> Processing Dependency: libstdc++-devel = 4.1.2-54.el5 for package: gcc-c++
--> Running transaction check
---> Package libstdc++.i386 0:4.1.2-54.el5 set to be updated
---> Package libstdc++-devel.i386 0:4.1.2-54.el5 set to be updated
updates/filelists_db                                                                                         | 688 kB     00:00     
http://ftp.swin.edu.au/centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://mirror.colocity.com/centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://mirror.usonyx.net/Linux/CentOS/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://centos.biz.net.id/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://centos.ipserverone.com/centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://kartolo.sby.datautama.net.id/Centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://mirror.nus.edu.sg/centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://ossm.utm.my/centos/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://mirror.ventraip.net.au/CentOS/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
updates/filelists_db                                                                                         | 688 kB     00:00     
http://mirrors.hostemo.com/CentOS/5.9/updates/i386/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/filelists.sqlite.bz2 from updates: [Errno 256] No more mirrors to try.
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.


居然找不到镜像去安装。


于是继续调查,发现可以通过 su -c 'yum clean all' 将yum默认的镜像清除,然后,再通过命令 yum install gcc-c++.i386 安装。


终于按装成功。
原创粉丝点击