简体   繁体   中英

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

I tried to compile a Thor library. It depends on SFML. I didnt had any problem with compiling SFGUI which also depends on SFML. Previously I used exactly the same toolchain. Everything worked fine

CMake gui errors:

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

I tried compiling simple int main(){} . gcc works. All paths are as intended. (Btw I don't use DevCpp, its just the path to the compiler).

I am surprised because g++ works, CMake is able to display identification but apparently not for gcc

Thanks for any help

The message appears on Solus OS if you don't install the essential build packages.

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.

You have to install the packages, using

sudo eopkg it -c system.devel

Then it works fine.

Fixed now by upgrading my GCC from 4.9.2 to 4.9.3. No more problems with crashing, however apparently there was a change related to C++11 standard and I need to manually edit CMakeLists.txt to change flag -std=c++11 to -std=gnu++11 when compiling any library and any program

MinGW / CxxTest bizarre errors

Edit: Switching/updating MinGW distro solved all problems. I tried updating the compiler to 7.2+/8.0+ versions and got rid of all confiuration problems. Likely it was a corrupted installaton or some older version bug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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