使用cmake编译boost时出现Bash错误

时间:2014-03-30 10:22:19

标签: bash boost cmake

我正在尝试编译boost(作为另一个库安装的一部分),但它向我报告我的gcc已损坏。

当我运行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项目时,编译它没有任何问题。

1 个答案:

答案 0 :(得分: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)是否已经输入了某个地方?