I am trying to compile a project, but CMake stops right at the beginning with the message that gcc is broken (see below). I am ignoramus when it comes to CMake, so any help where to get me starting debugging this problem is very very welcome.
- GCC (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 (I checked that my GCC compiles a 'hello world' problem)
- CMake version 2.8.7
- CMake command:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../Mantid
Output to terminal:
— The C compiler identification is GNU
— The CXX compiler identification is GNU
— Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
— Check for working C compiler: /usr/bin/gcc-4.6
— Check for working C compiler: /usr/bin/gcc-4.6 — broken
CMake Error at
/usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52
(MESSAGE):
The C compiler "/usr/bin/gcc-4.6" is not able to
compile a simple testprogram.
It fails with the following output:
Change Dir:
/home/jmborr/devel/mantidproject/mantid/Code/debug/CMakeFiles/CMakeTmpRun Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/buildmake[1]: Entering directory
`/home/jmborr/devel/mantidproject/mantid/Code/debug/CMakeFiles/CMakeTmp'/usr/bin/cmake -E cmake_progress_report
/home/jmborr/devel/mantidproject/mantid/Code/debug/CMakeFiles/CMakeTmp/CMakeFiles
1Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
/usr/bin/gcc-4.6 /usr/include -o
CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
/home/jmborr/devel/mantidproject/mantid/Code/debug/CMakeFiles/CMakeTmp/testCCompiler.cgcc-4.6: warning: /usr/include: linker input file unused because
linking not doneLinking C executable cmTryCompileExec
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec.dir/link.txt –verbose=1/usr/bin/gcc-4.6 /usr/include /usr/lib
CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec
-rdynamic/usr/bin/ld: cannot find /usr/include: File format not
recognized/usr/bin/ld: cannot find /usr/lib: File format not recognized
collect2: ld returned 1 exit status
make[1]: Leaving directory
Best Answer
Check this link.
I had the same problem. I think the problem is that you need more parameters to compile (like linker-script, flags ...). Change your CMakeLists.txt like this and try it again:
Do not forget to set the path to the compiler in your environment variables.