CMake 3.8 or higher is required. You are running version 3.5.1
提示目前的cmake版本过低的问题。
cmake -version
sudo apt remove cmake
wget http://www.cmake.org/files/v3.16/cmake-3.16.6.tar.gz
我这里下载的是cmake-3.16.6版本。
或是去文件库下载:https://cmake.org/files/v3.16/
备注:官网给出两种版本,一种是Source版的,另一种是Binary distributions里面的Linux x86_64,这是已经编译好的可执行版,直接拿来用的,只需要建立软连接即可,通过建立软链接调用Cmake-gui来使用cmake。
我这里下载的是以.tar.gz结尾的,source版的。
---------------------------------------------------------------------------------------------------------------------------------------------
tar xf cmake-3.16.6.tar.gz #解压,也可以右键直接提取出来
cd cmake-3.16.6
sudo apt-get install build-essential
---------------------------------------------------------------------------------------------------------------------------------------------
返回cmake-3.16.6的上层目录,修改文件权限:
sudo chmod -R 777 cmake-3.16.6
---------------------------------------------------------------------------------------------------------------------------------------------
再进入cmake-3.16.6文件夹,执行:
./bootstrap
若运行./bootstrap报错,请按照 错误1 的方法解决。然后再继续下面的安装步骤
---------------------------------------------------------------------------------------------------------------------------------------------
make
make install
若make和make install错误,请按照 错误2 的方法解决。
---------------------------------------------------------------------------------------------------------------------------------------------
验证:
cmake --version
若cmake --version错误,请按照 错误3 的方法解决。
---------------------------------------------------------------------------------------------------------------------------------------------
-- Looking for gethostname
-- Looking for gethostname - found
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
CMake Error at Utilities/cmcurl/CMakeLists.txt:454 (message):
Could not find OpenSSL. Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.
-- Configuring incomplete, errors occurred!
See also "/home/whlg/cmake-3.16.6/CMakeFiles/CMakeOutput.log".
See also "/home/whlg/cmake-3.16.6/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
提示找不到OpenSSL,查看错误日志,缺少软件包。
解决方案:
sudo apt-get install libssl-dev
./bootstrap
[100%] Built target foo
Install the project...
-- Install configuration: ""
CMake Error at Source/kwsys/cmake_install.cmake:41 (file):
file cannot create directory: /usr/local/doc/cmake-3.16/cmsys. Maybe need
administrative privileges.
Call Stack (most recent call first):
cmake_install.cmake:42 (include)
Makefile:76: recipe for target 'install' failed
make: *** [install] Error 1
解决方案:
直接在make 和 make install 前面加 sudo
解决方案:
sudo ln -s /usr/local/bin/cmake /usr/bin
转载链接:
cmake安装高版本
修改文件权限那一步原版本中描述存在一定错误,本文中已经改正。