CMake for some reason has stopped working recently. I’m trying to compile DDNet because I like to patch it however am failing. The same error occurs on every project using c(pp) with this error.
-- The C compiler identification is GNU 13.1.1
-- The CXX compiler identification is GNU 13.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/solly/Temp/cmaketest/build/CMakeFiles/CMakeScratch/TryCompile-IOmZ6M
Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_10cbb/fast && /usr/bin/make -f CMakeFiles/cmTC_10cbb.dir/build.make CMakeFiles/cmTC_10cbb.dir/build
make[1]: Entering directory '/home/solly/Temp/cmaketest/build/CMakeFiles/CMakeScratch/TryCompile-IOmZ6M'
/bin/sh: line 1: 2: command not found
/bin/sh: line 1: 255: command not found
/bin/sh: line 1: 221: command not found
/bin/sh: line 1: 255m: command not found
make[1]: *** [CMakeFiles/cmTC_10cbb.dir/build.make:77: CMakeFiles/cmTC_10cbb.dir/testCCompiler.c.o] Error 127
make[1]: Leaving directory '/home/solly/Temp/cmaketest/build/CMakeFiles/CMakeScratch/TryCompile-IOmZ6M'
make: *** [Makefile:127: cmTC_10cbb/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Configuring incomplete, errors occurred!
(cmake-examples/01-basic/A-hello-cmake at master · ttroy50/cmake-examples · GitHub)
Im on Arch Linux 6.3.3 x86_64 fully updated as of 7 Jun 2023
Cmake ver: 3.26.4
Make ver: GNU 4.4.1
GCC ver: 13.1.1
I can use c, c++ & Make on other projects & they work fine.
Subverting the issue by disabling/bypassing the compiler checks works for simple cases like these, but for DDNet just leads to more and more errors which I have spent a good time disabling all the checks for, but they never end…
I have no idea why this is happening, please help ):
Can you get the contents of that TryCompile-IOmZ6M file? Or otherwise find where these are coming from? It almost looks like ANSI color codes being output into the files. Do you have colors forced on for any relevant tool?
Nope, they are gone.
/bin/sh: line 1: 2: command not found
/bin/sh: line 1: 255: command not found
/bin/sh: line 1: 221: command not found
/bin/sh: line 1: 255m: command not found
suggets that it tried to execute ansii escape codes from some log output, i dont know how the heck that happens
So it calls make -f CMakeFiles/CMakeScratch/TryCompile-H8hzdo/
which calls make -f CMakeFiles/CMakeScratch/TryCompile-H8hzdo/CMakeFiles/Makefile2
which calls make -f CMakeFiles/CMakeScratch/cmTC_69db8.dir/Makefile (the H8hzdo directory does nothing)
which calls make -f CMakeFiles/CMakeScratch/cmTC_69db8.dir/CMakeFiles/Makefile2
which calls make -f CMakeFiles/cmTC_dbef9.dir/build.make CMakeFiles/cmTC_dbef9.dir/build (i cba to find the absolute path of these) (the m79UQt directory does nothing)
which finnally calls this
So it looks like CMake is using the COLOR variable. Makefiles will pick this up from the environment as well; do you have COLOR set in your environment?
The Makefile generators use a complicated setup in order to do some of the use cases they handle. Someday, we’ll get to rewrite it to be more like the Ninja generator which has a global view of the build graph (instead of the extra per-directory UI layer that gets put on top for the existing one). Generally, the Ninja generator is recommended these days.
As for the quotes, I’ll get an MR up. Thanks for the logs showing the problem.