读书人

安装gcc-4.7.1时遇到据说是很常见的ma

发布时间: 2012-10-16 09:57:37 作者: rapoo

安装gcc-4.7.1时遇到据说是很常见的make错误
make时遇到:
checking for suffix of object files... configure: error: in `/home/binghe/gcc-4.7/gcc-4.7.1/x86_64-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] 错误 1
make[2]:正在离开目录 `/home/binghe/gcc-4.7/gcc-4.7.1'
make[1]: *** [stage1-bubble] 错误 2
make[1]:正在离开目录 `/home/binghe/gcc-4.7/gcc-4.7.1'
make: *** [all] 错误 2

然后就停下了

在论坛里搜索时看有人要config.log文件信息的,我估计下面的部分是错误信息:
configure:3355: $? = 0
configure:3344: /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc -B/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/ -B/usr/gcc_4_7/x86_64-linux-gnu/bin/ -B/usr/gcc_4_7/x86_64-linux-gnu/lib/ -isystem /usr/gcc_4_7/x86_64-linux-gnu/include -isystem /usr/gcc_4_7/x86_64-linux-gnu/sys-include -v >&5
Reading specs from /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/specs
COLLECT_GCC=/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc
COLLECT_LTO_WRAPPER=/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../gcc-4.7.1/configure --build=x86_64-linux-gnu --prefix=/usr/gcc_4_7 --with-gmp=/usr/gcc_4_7 --with-mpfr=/usr/gcc_4_7 --with-mpc=/usr/gcc_4_7 --enable-checking=release --enable-languages=c,c++ --disable-multilib -program-suffix=-4.7
Thread model: posix
gcc version 4.7.1 (GCC)
configure:3355: $? = 0
configure:3344: /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc -B/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/ -B/usr/gcc_4_7/x86_64-linux-gnu/bin/ -B/usr/gcc_4_7/x86_64-linux-gnu/lib/ -isystem /usr/gcc_4_7/x86_64-linux-gnu/include -isystem /usr/gcc_4_7/x86_64-linux-gnu/sys-include -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3344: /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc -B/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/ -B/usr/gcc_4_7/x86_64-linux-gnu/bin/ -B/usr/gcc_4_7/x86_64-linux-gnu/lib/ -isystem /usr/gcc_4_7/x86_64-linux-gnu/include -isystem /usr/gcc_4_7/x86_64-linux-gnu/sys-include -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3371: /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc -B/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/ -B/usr/gcc_4_7/x86_64-linux-gnu/bin/ -B/usr/gcc_4_7/x86_64-linux-gnu/lib/ -isystem /usr/gcc_4_7/x86_64-linux-gnu/include -isystem /usr/gcc_4_7/x86_64-linux-gnu/sys-include -o conftest -g -O2 conftest.c >&5
/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
configure:3374: $? = 1
configure:3562: checking for suffix of object files
configure:3584: /home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/xgcc -B/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/ -B/usr/gcc_4_7/x86_64-linux-gnu/bin/ -B/usr/gcc_4_7/x86_64-linux-gnu/lib/ -isystem /usr/gcc_4_7/x86_64-linux-gnu/include -isystem /usr/gcc_4_7/x86_64-linux-gnu/sys-include -c -g -O2 conftest.c >&5
/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
configure:3588: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"


| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3602: error: in `/home/binghe/gcc-4.7/gcc-4.7.1/x86_64-linux-gnu/libgcc':
configure:3605: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

不过为了以防万一,我把整个文件贴出来:


[解决办法]
不用搞4.7.1了. 已经出4.7.2了....
现在编译gcc请准备gmp/mpc/mpfr/cloog/ppl这几个库.另外,还请注意版本,太新或太旧也不行.
/home/binghe/gcc-4.7/gcc-4.7.1/host-x86_64-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
libmpc.so就是mpc这库.你看下版本,配置之类的吧.
现在的gcc已经很好编译了.不像以前.经常出问题...
[解决办法]
运行不正常?是什么状况?
我分别编译了x86-linux/win32下针对4个不同target的版本,没见有什么问题啊
[解决办法]

探讨

比如一面这段程序:
C/C++ code

#include <iostream>
#include<thread>
using namespace std;
void thread_fun()
{
for (int i = 0 ; i < 100 ; ++i)
{
cout<<i<<endl;
}
}
int main()
{
thread ……

[解决办法]
g++ -std=c++0x test.cpp -lpthread

读书人网 >C++

热点推荐