27

I just installed cmake but I'm getting compiler not found error.

In trying to build https://gitlab.com/interception/linux/tools on a new Kubuntu installation, running cmake .. from the tools/build directory returns the error:

CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

What's wrong? I assumed cmake would be equipped with its compiler, but maybe it needs to be configured before it can be used???

alec
  • 1,508
  • 3
  • 15
  • 26

4 Answers4

50

The "compiler" is a separate package that needs to be installed. One called g++ can be installed on it's own and is also included within a bundle of packages called "build-essential".

Thus sudo apt-get install build-essential solves the problem (and sudo apt-get install g++ should also work), allowing cmake .. to work with no configuration necessary.

alec
  • 1,508
  • 3
  • 15
  • 26
  • Apparently `cmake` is useful outside the context of *compiling*. See [is it possible to use cmake without any compiler](https://stackoverflow.com/questions/46176955/is-it-possible-to-use-cmake-without-any-compiler). – alec Dec 31 '20 at 18:53
  • 1
    I already had `build-essentials` and `g++` but still encountered this error. Seems in my case I had to install `clang`. (`sudo apt-get install clang`) – Seth Falco Jul 31 '22 at 19:49
2

I ran into the same issue with Alpine. After installing the following libraries, everything went through as expected:

apk add git cmake make clang build-base llvm-static llvm-dev clang-static clang-dev
wout
  • 121
  • 3
1

For CenOS variant distros it was missing nasm. Installing it solves the issue:

yum install -y nasm 
alec
  • 1,508
  • 3
  • 15
  • 26
Salem F
  • 133
  • 7
0

First download eCAL archives(latest version) install. Go to terminal type:

sudo apt-get update
sudo apt-get install ecal
sudo apt-get install build-essential
sudo apt install cmake g++ libprotobuf-dev protobuf-compiler
sudo apt-get update
Fco Javier Balón
  • 1,144
  • 2
  • 11
  • 31