系统相关
首页 > 系统相关> > Ubuntu18/16 升级默认apt安装的cmake版本

Ubuntu18/16 升级默认apt安装的cmake版本

作者:互联网

Ubuntu系统使用命令‘sudo apt-get install cmake‘ 版本是比较低的3.10,不能满足编译需求。需要升级,但是根据网上搜到的卸载 ' sudo apt-get autoremove cmake’ 会把之前编译好的ros相关包卸载。

最后找到的解决方案如下:

1,在官网下载你需要的cmake版本:cmake官网下载:https://cmake.org/download/

2,解压文件夹。比如我下载的是cmake-3.19.8,解压后是一个文件夹:cmake-3.19.8-Linux-x86_64

3,将解压后的文件夹复制到一个系统路径,使其不易被误删除,然后建立软链接,即可升级低版本的cmake

sudo mv cmake-3.19.8-Linux-x86_64 /opt/cmake-3.19.8

# 建立软链接
sudo ln -sf /opt/cmake-3.19.80/bin/*  /usr/bin/

# 查看 cmake 版本
cmake --version

 

如果安装了多个cmake,执行cmake --version可能会报如下错,

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/Applications/CMake 2.8-11.app/Contents/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
解决方法:

$ hash -r

 

标签:3.19,cmake,16,sudo,apt,Error,CMake
来源: https://blog.csdn.net/u010420283/article/details/117632307