我曾使用过这个指令: 如何在 Ubuntu 中升级 cmake 当我在其他终端中写下这些内容时,提供了最后一步:
cmake --version
我遇到了这个错误:
bash: /usr/bin/cmake: No such file or directory
调用后:
cmake ../
当我尝试时:
/tmp/gazebo/build$ sudo cmake ../
我有这个:
[sudo] password for dmitriy:
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:16 (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.
-- Configuring incomplete, errors occurred!
See also "/tmp/gazebo/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/gazebo/build/CMakeFiles/CMakeError.log".
在我使用这个答案之后Pytest 在 PATH 中但未找到 我遇到了这个错误
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:312 (file):
file failed to open for writing (Permission denied):
/tmp/gazebo/build/CMakeFiles/3.23.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:323 (CMAKE_DETERMINE_COMPILER_ID_WRITE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCompilerId.cmake:59 (__determine_compiler_id_test)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:120 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:16 (project)
-- The CXX compiler identification is unknown
CMake Error: Could not open file for write in copy operation /tmp/gazebo/build/CMakeFiles/3.23.0/CMakeCXXCompiler.cmake.tmp
CMake Error: : System Error: Permission denied
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/CMakeDetermineCXXCompiler.cmake:226 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:16 (project)
CMake Error: Could not find cmake module file: /tmp/gazebo/build/CMakeFiles/3.23.0/CMakeCXXCompiler.cmake
CMake Error at CMakeLists.txt:16 (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.
-- Configuring incomplete, errors occurred!
See also "/tmp/gazebo/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/gazebo/build/CMakeFiles/CMakeError.log".
在我用答案回答这个问题之后https://stackoverflow.com/questions/31421327/cmake-cxx-compiler-broken-while-compiling-with-cmake 我遇到了这个错误
====== Finding 3rd Party Packages ======
-- Operating system is Linux
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Checking for module 'freeimage>=3.9.0'
-- No package 'freeimage' found
-- freeimage.pc not found, trying freeimage_include_dir and freeimage_library_dir flags.
-- Looking for FreeImage.h - not found
-- Missing: Unable to find FreeImage.h
-- Looking for libfreeimage - not found
-- Missing: Unable to find libfreeimage
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
CMake Error at /opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/opt/cmake-3.23.0-linux-x86_64/share/cmake-3.23/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/SearchForStuff.cmake:34 (find_package)
CMakeLists.txt:163 (include)
-- Configuring incomplete, errors occurred!
See also "/tmp/gazebo/build/CMakeFiles/CMakeOutput.log".