How to reinstall the latest cmake version?

无人久伴 提交于 2020-05-10 04:40:10

问题


I would like to install cmake the latest version, on Linux environment. I have cmake version 3.5 installed and is not supported by some applications. I tried to upgrade it by uninstalling the current version. But when I reinstall with sudo apt-get install cmake, I get the same version 3.5 re-installed. How do I install the latest version with sudo apt-get install ....?


回答1:


As far as I know the best way to get the latest CMake version installed on any Linux is not by apt but using pip.

Remove the apt cmake and install the latest version from pip which can easily keep up-to-date.

apt remove cmake
pip install cmake --upgrade



回答2:


Edit: As GNUton has pointed out, the following only works on Ubuntu 16.04 and 18.04(Checked on June 2019).

Now CMake developer team in Kitware Inc provides APT repositiory. It allows you to install latest CMake via apt-get.

  1. If you are using a minimal Ubuntu image or a Docker image, you may need to install the following packages:

    sudo apt-get update
    sudo apt-get install apt-transport-https ca-certificates gnupg \
                             software-properties-common wget
    
  2. Obtain a copy of our signing key:

    wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc |
        sudo apt-key add -
    
  3. Add the repository to your sources list and update.

    For Ubuntu Bionic Beaver (18.04):

    sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
    sudo apt-get update
    

    For Ubuntu Xenial Xerus (16.04):

    sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
    sudo apt-get update
    
  4. ... Optional steps. See details in reference.
  5. ... Optional steps. See details in reference.

    Now call

    sudo apt-get install cmake
    

Reference: Kitware APT Repository.




回答3:


You can try the following steps that have worked for me on Ubuntu 18.04.3 LTS as OS of the NVIDIA jetson Nano to get the last version of cmake "cmake-3.14.0" from 'https://cmake.org/download/'.

  1. Delete the installed version in your system

    sudo apt purge cmake

  2. Downloading cmake3.14

    wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz

  3. Extract files

    tar zxcf cmake-3.13.4.tar.gz

  4. Execute the following commands in this order to build it

    cd cmake-3.13.4

    sudo ./bootstrap

    sudo make

    sudo make install

  5. Verify the version if it is installed correctly

    cmake --version




回答4:


Following the comments made on how to Install the latest CMake version and to post the answer for this question:

Ans:

This depends with Ubuntu OS version currently installed on your PC or Mac. If you have the following Ubuntu OS version then you have this CMake installed or that you could install and reinstall with "sudo apt-get install cmake". Even if you uninstall your version and try to reinstall later version.

Ubuntu 16.04 ships with cmake-3.5.1
Ubuntu 17.10  ships with  cmake-3.9.1  and Ubuntu 18.04 ships with cmake-3.10.2.

Now if you have Ubuntu 16.04 installed and you want cmake-3.10, there is OS problem since you can only install and reinstalled cmake-3.5.1. To get cmake-3.10 or any other version, you have to download and install the package from https://packages.ubuntu.com/. Once you find the latest version of cmake .targz files, you have to build it yourself from the command line.



来源:https://stackoverflow.com/questions/49859457/how-to-reinstall-the-latest-cmake-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!