linux 下如何升级CMAKE?(安装指定版本cmake)(高版本cmake)(不删除之前的,可以用软连接)
生活随笔
收集整理的這篇文章主要介紹了
linux 下如何升级CMAKE?(安装指定版本cmake)(高版本cmake)(不删除之前的,可以用软连接)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 原
- 20210929 但是卸載不知道怎么卸載,尷尬了。。。。
- 20220209 貌似原來cmake不需要卸載,直接安裝新的然后做個軟連接就好了
原
先把當前版本全卸載
# sudo apt remove cmake # sudo apt purge --auto-remove cmake然后到cmake官網下載指定.sh版本
https://cmake.org/files/
我i下這個
下完后復制到虛擬機里
終端運行
sudo ./cmake-3.8.0-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local如果提示沒權限就賦予777權限
詳細指令:
root@ubuntu:/home/yg/share# ./cmake-3.8.0-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local bash: ./cmake-3.8.0-Linux-x86_64.sh: 權限不夠 root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# chmod 777 cmake-3.8.0-Linux-x86_64.sh root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# ./cmake-3.8.0-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local CMake Installer Version: 3.8.0, Copyright (c) Kitware This is a self-extracting archive. The archive will be extracted to: /usr/localUsing target directory: /usr/local Extracting, please wait...Unpacking finished successfully root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share# root@ubuntu:/home/yg/share#測試版本:
root@ubuntu:/home/yg/share# cmake --version cmake version 3.8.0CMake suite maintained and supported by Kitware (kitware.com/cmake).參考文章:如何指定在Ubuntu中安裝CMake的位置?
20210929 但是卸載不知道怎么卸載,尷尬了。。。。
20220209 貌似原來cmake不需要卸載,直接安裝新的然后做個軟連接就好了
參考文章:ubuntu16.04升級cmake版本,可任意切換版本
https://cmake.org/files/
下這個:
以 3.13.0 版本為例:(嫌用wget下太慢用迅雷下好再扔進Ubuntu里)
以下幾個步驟分別為:下載、解壓、移動、建立軟連接
wget https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz tar -xzvf cmake-3.13.0-Linux-x86_64.tar.gz sudo mv cmake-3.13.0-Linux-x86_64 /opt/cmake-3.13.0 sudo ln -sf /opt/cmake-3.13.0/bin/* /usr/bin/ cmake --version結果:
[root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]5# cmake --version cmake version 3.5.1CMake suite maintained and supported by Kitware (kitware.com/cmake). [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]6# [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]6# [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]6# [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]6# sudo ln -sf /opt/cmake-3.13.0/bin/* /usr/bin/ [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]7# [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]7# [root@ubuntu /home/arnold/Arnold_test/20220209_cmake3.13]7# cmake --version cmake version 3.13.0CMake suite maintained and supported by Kitware (kitware.com/cmake).可以看到,cmake的版本變化了,但其實之前的并沒有刪除
如果要刪除軟連接,直接重新做一下軟連接就可以了(不過應該要先到/usr/bin里刪除軟連接,然后找到cmake3.5.1老版本的位置,重新做一次軟連接)
總結
以上是生活随笔為你收集整理的linux 下如何升级CMAKE?(安装指定版本cmake)(高版本cmake)(不删除之前的,可以用软连接)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: arm-linux 程序开发入门(QT窗
- 下一篇: ubuntu etc目录下配置文件pro