2014-03-30 30 views
1

我想编译boost(作为另一个库安装的一部分),但它向我报告我的gcc已损坏。bash错误,同时用cmake编译提升

当我运行cmake我得到

-- The C compiler identification is unknown 
-- The CXX compiler identification is GNU 4.7.2 
-- Check for working C compiler: /usr/bin/gcc 
-- Check for working C compiler: /usr/bin/gcc -- broken 
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): 
    The C compiler "/usr/bin/gcc" is not able to compile a simple test program. 

    It fails with the following output: 

    Change Dir: /home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp 



    Run Build Command:/usr/bin/make "cmTryCompileExec3895803733/fast" 

    /usr/bin/make -f CMakeFiles/cmTryCompileExec3895803733.dir/build.make 
    CMakeFiles/cmTryCompileExec3895803733.dir/build 

    make[1]: Entering directory 
    `/home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp' 


    /usr/bin/cmake -E cmake_progress_report 
    /home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp/CMakeFiles 
    1 

    Building C object 
    CMakeFiles/cmTryCompileExec3895803733.dir/testCCompiler.c.o 

    /usr/bin/gcc -m64 -O3 -march=native (Default on Linux) -o 
    CMakeFiles/cmTryCompileExec3895803733.dir/testCCompiler.c.o -c 
    /home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp/testCCompiler.c 


    /bin/sh: 1: Syntax error: "(" unexpected 

    make[1]: *** [CMakeFiles/cmTryCompileExec3895803733.dir/testCCompiler.c.o] 
    Error 2 

    make[1]: Leaving directory 
    `/home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp' 


    make: *** [cmTryCompileExec3895803733/fast] Error 2 





    CMake will not be able to correctly generate this project. 
Call Stack (most recent call first): 
    CMakeLists.txt:28 (project) 


-- Configuring incomplete, errors occurred! 

我真的不知道什么可能是错误的。当我在C中创建自己的cmake项目时,我没有编译它的问题。

+0

值得一提的是'Boost.CMake'并不是通常的建设方式。通常我们使用'Boost.Build'系统。参见[www.boost.org:入门](http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html)。另外,你的编译器[有点过时]。(http://www.gnu.org/software/gcc/releases.html)这些都不是问题,但可能会让你的生活更加困难。至于CMake,你显然有这样的问题:'/ usr/bin/gcc -m64 -O3 -march = native(在Linux上是默认的)......' – Drop

回答

3

你得到的错误不是从gcc而是从/bin/sh,没有迹象表明问题实际上是与gcc本身。

/usr/bin/gcc -m64 -O3 -march=native (Default on Linux) -o 
CMakeFiles/cmTryCompileExec3895803733.dir/testCCompiler.c.o -c 
/home/lecopivo/code/bempp-inst/bempp/build/contrib/boost/build/CMakeFiles/CMakeTmp/testCCompiler.c 


/bin/sh: 1: Syntax error: "(" unexpected 

这个值是(Default on Linux)你输入了什么地方?

+0

我很盲目:D修正并且工作。我想知道为什么'sh'出现错误。 – tom

+0

我在考虑删除问题。因为这只会对未来的谷歌玩家产生误导和不利影响。你还好吗?我想如果我删除它,你不会得到你的15分。 – tom

+0

你的感觉是最好的。我认为,从目前的问题来看,要仔细阅读日志以查看实际发生的情况,而不是按照面值采用最初的“检查工作C编译器:/ usr/bin/gcc - broken”消息。 –