繁体   English   中英

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

[英]CMake: The C compiler is not able to compile a simple test program. Surprisingly C compiler identification is unknown but CXX is GNU 4.9.2

我试图编译一个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

谢谢你的帮助

如果您不安装基本构建包,则会在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

然后它工作正常。

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

MinGW / CxxTest奇怪的错误

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM