ablog

不器用で落着きのない技術者のメモ

cmake 時に "CMAKE_CXX_COMPILER-NOTFOUND" was not found と怒られる

事象

  • perf-map-agent を cmake しようとすると、"CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name." というエラーになる。
$ sudo yum -y install java-1.8.0-openjdk-devel.x86_64
$ sudo yum install -y perf git cmake
$ git clone https://github.com/jvm-profiling-tools/perf-map-agent.git
$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/
$ cd perf-map-agent
$ cmake .
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/ec2-user/perf-map-agent/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/ec2-user/perf-map-agent/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/ec2-user/perf-map-agent/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The C compiler identification is unknown
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/ec2-user/perf-map-agent/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:90 (file):
  file Internal CMake error when trying to open file:
  /home/ec2-user/perf-map-agent/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
  for writing.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:100 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
  /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- JNI_INCLUDE_DIRS=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/include;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/include/linux;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/include
-- JNI_LIBRARIES=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/jre/lib/amd64/server/libjvm.so
-- JAVA_INCLUDE_PATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/include
-- JAVA_INCLUDE_PATH2=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/include/linux
-- Configuring incomplete, errors occurred!
See also "/home/ec2-user/perf-map-agent/CMakeFiles/CMakeOutput.log".
See also "/home/ec2-user/perf-map-agent/CMakeFiles/CMakeError.log".

原因

  • gccgcc-c++ がインストールされていないため。

解決策

  • gccgcc-c++ をインストールする。
$ sudo yum install gcc gcc-c++