Ubuntu: How to upgrade cmake in Ubuntu



Question:

CMake Error at CMakeLists.txt:1 (cmake_minimum_required):    CMake 3.6.0 or higher is required.  You are running version 3.5.1  -- Configuring incomplete, errors occurred!  

I know Ubuntu uses stable releases that it can support, but some repos require later versions of cmake. I want to overwrite the old cmake with the later version of cmake, but the common PPA doesn't carry the cmake I need. How can I upgrade cmake to use the needed version without conflicts with the older version?


Solution:1

  1. Check your current version with cmake --version
  2. Uninstall it with sudo apt remove cmake
  3. Visit https://cmake.org/download/ and download the latest binaries
    • In my case cmake-3.6.2-Linux-x86_64.sh is sufficient
  4. chmod +x /path/to/cmake-3.6.2-Linux-x86_64.sh (use your own file location here, but chmod makes the script executable)
  5. sudo /path/to/cmake-3.6.2-Linux-x86_64.sh (you'll need to press y twice)

    The script installs to /opt/cmake-3.6.2-Linux-x86_64 so in order to get the cmake command, make a symbolic link:

  6. sudo ln -s /opt/cmake-3.6.2-Linux-x86_64/bin/* /usr/local/bin

    Test your results with cmake --version


Solution:2

I would like to follow your advice Wolf, but the script don't install the prog. So i just creat the folder but doesn't show like installed when i do

 cmake --version   

I find a other way peraps more easy :

sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x  sudo -E apt-get update  sudo apt-get install cmake  


Solution:3

In the new version of cmake (ex: 3.9.6), to install, download tar from https://cmake.org/download/. Extract the downloaded tar file and then:

cd $CMAKE_DOWNLOAD_PATH  ./configure  make  make install  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »