cmake安装更新(解决cmake报错:CMake 3.8 or higher is required. You are running version 3.5.1)

ubuntu16.04在安装libfreenect过程中,出现cmake报错:CMake 3.8 or higher is required. You are running version 3.5.1
cmake3.5.1是在安装ubuntu系统时安装的默认版本,需要自行下载cmake更高版本进行安装。

1.查看当前版本

cmake --version

2.卸载cmake(安装ros时可跳过)

sudo apt remove cmake

注:再此步骤中,如果安装了ros系统,提示会卸载许多与ros相关的cmake文件,可能会导致ros无法使用,所以跳过此步。

3.下载更高版本cmake,可在cmake官网下载,我下载的是cmake-3.16.8.tar.gz

4.安装cmake
(1)将cmake-3.16.8.tar.gz解压
(2)将原来版本的cmake执行文件删除

cd /usr/bin/
sudo rm cmake

(3)将cmake-3.16.8.tar.gz提取出来并安装

cd cmake-3.16.8
./configure
make
sudo make install
cmake --version

安装成功后显示如下
cmake安装更新(解决cmake报错:CMake 3.8 or higher is required. You are running version 3.5.1)_第1张图片
可能出现的错误及其解决方法:
错误1: 在./configure时出现报错:

Error when bootstrapping CMake:
Cannot find appropriate Makefile processor on this system.
Please specify one using environment variable MAKE.

解决方法

sudo apt-get install make

错误2:在./configure时出现报错:

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.
  
Error when bootstrapping CMake:
Problem while running initial CMake

提示找不到OpenSSL,查看错误日志,缺少软件包。
解决方法:

sudo apt-get install libssl-dev

错误3:

CMake Error: The current CMakeCache.txt directory

原因:項目切換了文件夾
解決方法:刪掉CMakeCache.txt(在目標文件所在的文件夾),重新config,build,run;

参考链接:
https://blog.csdn.net/mengyu_0317/article/details/106868041
https://wanxuexiang.blog.csdn.net/article/details/84070116

你可能感兴趣的:(软件安装,ubuntu)