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。我在编译也依赖于 SFML 的 SFGUI 时没有遇到任何问题。以前我使用完全相同的工具链。一切正常
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(){}
。海湾合作委员会工作。
所有路径都符合预期。 (顺便说一句,我不使用 DevCpp,它只是编译器的路径)。
我很惊讶,因为 g++ 可以工作,CMake 能够显示标识,但对于 gcc 显然不行
感谢您的帮助
现在通过将我的 GCC 从 4.9.2 升级到 4.9.3 来修复。没有更多的崩溃问题,但是显然有一个与 C++11 标准相关的更改,我需要手动编辑 CMakeLists.txt 以在编译任何库和任何时将标志 -std=c++11
更改为 -std=gnu++11
节目
编辑:Switching/updating MinGW 发行版解决了所有问题。我尝试将编译器更新到 7.2+/8.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
然后就可以正常工作了。
我试图编译一个 Thor 库。这取决于 SFML。我在编译也依赖于 SFML 的 SFGUI 时没有遇到任何问题。以前我使用完全相同的工具链。一切正常
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(){}
。海湾合作委员会工作。
所有路径都符合预期。 (顺便说一句,我不使用 DevCpp,它只是编译器的路径)。
我很惊讶,因为 g++ 可以工作,CMake 能够显示标识,但对于 gcc 显然不行
感谢您的帮助
现在通过将我的 GCC 从 4.9.2 升级到 4.9.3 来修复。没有更多的崩溃问题,但是显然有一个与 C++11 标准相关的更改,我需要手动编辑 CMakeLists.txt 以在编译任何库和任何时将标志 -std=c++11
更改为 -std=gnu++11
节目
编辑:Switching/updating MinGW 发行版解决了所有问题。我尝试将编译器更新到 7.2+/8.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
然后就可以正常工作了。