CMake:C编译器无法编译简单的测试程序。令人惊讶的是,C编译器识别是未知的,但CXX是GNU 4.9.2

时间:2016-08-03 11:03:29

标签: c++ cmake mingw

我试图编译一个Thor库。这取决于SFML。编译SFGUI时也没有任何问题,SFGUI也依赖于SFML。以前我使用完全相同的工具链。一切都很好

CMake gui错误:

The C compiler identification is unknown
The CXX compiler identification is GNU 4.9.2
Check for working C compiler: E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe
Check for working C compiler: E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe -- broken
CMake Error at C:/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp



Run Build
Command:"E:/Programs_Portable/Dev-Cpp/minGW32/bin/mingw32-make.exe"
"cmTC_6b11a/fast"

E:/Programs_Portable/Dev-Cpp/minGW32/bin/mingw32-make.exe -f
CMakeFiles\cmTC_6b11a.dir\build.make CMakeFiles/cmTC_6b11a.dir/build


mingw32-make.exe[1]: Entering directory
'D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp'


Building C object CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj


E:\Programs_Portable\Dev-Cpp\minGW32\bin\gcc.exe -o
CMakeFiles\cmTC_6b11a.dir\testCCompiler.c.obj -c
D:\Michal\Pliki\thor-v2.0-sdk\build\CMakeFiles\CMakeTmp\testCCompiler.c


<built-in>: internal compiler error: Segmentation fault


libbacktrace could not find executable to open


Please submit a full bug report,


with preprocessed source if appropriate.


See <http://sourceforge.net/projects/mingw-w64> for instructions.


CMakeFiles\cmTC_6b11a.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj' failed


mingw32-make.exe[1]: *** [CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj]
Error 1


mingw32-make.exe[1]: Leaving directory
'D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp'


makefile:125: recipe for target 'cmTC_6b11a/fast' failed


mingw32-make.exe: *** [cmTC_6b11a/fast] Error 2






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


Configuring incomplete, errors occurred!
See also "D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeOutput.log".
See also "D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeError.log".

我尝试编译简单的int main(){}。 gcc工作。 所有路径都符合预期。 (顺便说一下,我没有使用DevCpp,它只是编译器的路径)。

我很惊讶因为g ++有效,CMake能够显示识别但显然不适用于gcc

感谢您的帮助

2 个答案:

答案 0 :(得分:0)

现在通过将我的GCC从4.9.2升级到4.9.3来修复。没有崩溃的问题,但显然有一个与C ++ 11标准相关的更改,我需要在编译任何库和任何程序时手动编辑CMakeLists.txt以将标记-std=c++11更改为-std=gnu++11 / p>

MinGW / CxxTest bizarre errors

编辑:切换/更新MinGW发行版解决了所有问题。我尝试将编译器更新到7.2 + / 8.0 +版本,并摆脱了所有的配置问题。可能它是一个损坏的installaton或一些旧版本的bug

答案 1 :(得分:0)

如果您没有安装基本的构建软件包,则消息会出现在 Solus OS 上。

CMake Error at /usr/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

   "/usr/bin/cc"

is not able to compile a simple test program.

您必须使用来安装软件包

sudo eopkg it -c system.devel

然后正常工作。