cmake
build_error
ai_generated
true
CMake Error: No CMAKE_CXX_COMPILER could be found
ID: cmake/no-cxx-compiler-found
92%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3 | active | — | — | — |
Root Cause
CMake cannot find a C/C++ compiler. Toolchain not installed or not in PATH.
genericWorkarounds
-
95% success Install the compiler toolchain
sudo apt install build-essential
Sources: https://cmake.org/cmake/help/latest/
-
85% success Use CMake toolchain file for cross-compilation
cmake -DCMAKE_TOOLCHAIN_FILE=arm-toolchain.cmake ..
-
88% success Specify compiler explicitly
cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++-12 ..
Dead Ends
Common approaches that don't work:
-
Set CMAKE_CXX_COMPILER to compiler include directory
82% fail
Must point to compiler EXECUTABLE (e.g., /usr/bin/g++), not a directory
-
Install cmake assuming it includes a compiler
88% fail
CMake is a build system generator, not a compiler. You need gcc/g++ separately.