cmake 提示gcc或交叉编译 broken

cmake reports gcc is broken. Where do I start?

-- Check for working C compiler: /usr/bin/gcc -- broken

CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

-- 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.


解决


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 like this and try it again:

INCLUDE(CMakeForceCompiler) CMAKE_FORCE_C_COMPILER(gcc GNU) CMAKE_FORCE_CXX_COMPILER(g++ GNU)

do not forget to set the path to the compiler in your enviroment vars.

参考

http://stackoverflow.com/questions/16594053/cmake-reports-gcc-is-broken-where-do-i-start

你可能感兴趣的:(gcc,cmake,Broken)