Linux как обновить cmake

How do I install the latest version of cmake from the command line?

The most common situation is when you want to install the latest version of cmake, but your Operating System’s repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of 3.19.1 which is the current version at cmake.org.

How can I get the latest version?

Well, we can install it by following one of these methods: Building and Installing or Using binary files.

A-1. Uninstall the default version provided by Ubuntu’s package manager and configuration by using:

sudo apt remove --purge --auto-remove cmake 
sudo apt purge --auto-remove cmake 

A-2. Go to the official CMake webpage, then download and extract the latest version. Update the version and build variables in the following command to get the desired version:

version=3.19 build=1 mkdir ~/temp cd ~/temp wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz tar -xzvf cmake-$version.$build.tar.gz cd cmake-$version.$build/ 

A-3. Install the extracted source by running:

./bootstrap make -j$(nproc) sudo make install 

A-4. Test your new cmake version.

cmake version 3.19.X CMake suite maintained and supported by Kitware (kitware.com/cmake). 

B. Using binary files ( cmake-gui wont work well)

B-1. Uninstall the default version provided by Ubuntu’s package manager as in A-1.

Читайте также:  Usb мегафон модем linux

B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake . Update the version and build variables in the following command to get the desired version:

version=3.19 build=1 mkdir ~/temp cd ~/temp wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh sudo mkdir /opt/cmake sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake 

B-3. Add the installed binary link to /usr/local/bin/cmake by running this:

sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake 

B-4. Test your new cmake version as in A-4.

Note

In 3.19.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official web page the Latest Release is 3.19.1. If you want the Previous Release 3.18.5 just replace the version and build parameters like this:

Kitware now has an APT repository that currently supports Ubuntu 16.04, 18.04 and 20.04

Install Instructions:

    Remove old version of cmake

sudo apt purge --auto-remove cmake 
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null 
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' 
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' 
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' 
sudo apt update sudo apt install cmake 

First uninstall any cmake package previously installed. Then:

  1. Go to http://www.cmake.org/download/ and download the latest .sh installer
  2. Install it (for example) in opt/cmake by running
sudo mkdir /opt/cmake sudo sh --prefix=/opt/cmake 

Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.

Источник

Русские Блоги

Установите другие версии Cmake или обновление Cmake на Linux

Каталог статьи:

1 Причина проблемы

Сначала необходимо преобразовать модель PB TensorFlow в модель ONNX, а затем преобразовать ее в Tensorrt’s Model.

В процессе установки ONNX2Tensorrt вам нужно использовать cmake Потому что моя версия относительно низкая, мне это нужно Обновите версию Cmake

cmake .. -DTENSORRT_ROOT=../tensorrt_root && make -j

(yolov4) [email protected]-mint:~/shl_res/1_project/yolov4-deepsort/checkpoints/onnx-tensorrt/build$ cmake .. -DTENSORRT_ROOT=../tensorrt_root && make -j CMake Error at CMakeLists.txt:21 (cmake_minimum_required): CMake 3.13 or higher is required. You are running version 3.10.2 -- Configuring incomplete, errors occurred! (yolov4) [email protected]-mint:~/shl_res/1_project/yolov4-deepsort/checkpoints/onnx-tensorrt/build$ 

2 обновленная версия Cmake

1. Различные версии CMAKE. Скачать пакет установки

2. Ссылка на учебное пособие по установке

я использую sudo apt-get install cmake Установка по умолчанию 3.10.2 , Давайте составим здесь, что версия Cmake не менее 3,13 или более

Удалить старую версию Cmake

Лучше всего не использовать команду выше, чтобы удалить или перемещать каталог, где старая версия Cmake расположена на резервном копировании рабочего стола

Старая версия Cmake не может быть удалена, поэтому команда выше Вы также можете использовать его без использования Потому что я При удалении старой версии Cmake , Это автоматически удаляет много зависимости, моя Система АФК также удаляется ,Привет, Я просто хочу сказать FK!

3. Загрузите пакет установки Cmake, здесь я загружаю 3.16.8

Cmake-3.16.8-Linux-X86_64.TAR.GZ Скомпилируется компрессионный пакет, и он может использоваться по декомпрессии!

sudo ln -s /home/shl/tools/cmake-3.16.8-Linux-x86_64/bin/cmake /usr/bin/cmake

Если мягкая ссылка успешна, вы можете использовать Cmake

(base) [email protected]-mint:~/tools$ sudo ln -s /home/shl/tools/cmake-3.16.8-Linux-x86_64/bin/cmake /usr/bin/cmake (base) [email protected]-mint:~/tools$ cmake --version cmake version 3.16.8 CMake suite maintained and supported by Kitware (kitware.com/cmake). (base) [email protected]-mint:~/tools$ 

Источник

Install/Upgrade cmake 3.12.1 on Ubuntu 14.04 using alternatives

Since then a couple of new versions were released and the same procedure can still be used to install cmake 3.12.1.

$ wget http://www.cmake.org/files/v3.12/cmake-3.12.1.tar.gz
$ tar -xvzf cmake-3.12.1.tar.gz
$ cd cmake-3.12.1/
$ ./configure
$ make

Make’s install command installs cmake by default in /usr/local/bin/cmake, shared files are installed into /usr/local/share/cmake-3.10.

Now it’s time to create a backup, in case you need to roll back to the old version:

$ /usr/local/bin/cmake —version
cmake version 3.10.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ sudo cp -p /usr/local/bin/cmake

$ ll /usr/local/bin/cmake*
-rwxr-xr-x 1 root root 16509675 Dez 22 2017 /usr/local/bin/cmake
-rwxr-xr-x 1 root root 16509675 Dez 22 2017 /usr/local/bin/cmake.3.10.1

To install (copy) the binary and libraries to the new destination, run:

$ sudo make install

If you haven’t already installed a newer cmake installation, run the following command to tell Ubuntu that the cmake command is now being replaced by an alternative installation:

$ sudo update-alternatives —install /usr/bin/cmake cmake /usr/local/bin/cmake 1 —force

If you already have a custom cmake version installed (in my case I still had the 3.10.1 version active), the update-alternatives command is not necessary.
The make install command will replace the existing binary in /usr/local/bin/cmake. This can be verified using:

$ cmake —version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Add a comment

Comments (newest first)

Alain from wrote on Oct 31st, 2019:

Good tutorial, thanks. Would be worthwhile to make two tweaks:
1) Suggests users download and build in a temporary folder (eg. $HOME/tmp)
2) After installation is complete, the temporary folder can be deleted

tayyab from Pakistan wrote on Oct 25th, 2019:

Thanks for your helpful insights on installing cmake.

Blog Tags:

© 2008 — 2023 by Claudio Kuenzler. Powered by .

This website uses own and third-party 🍪 cookies to improve your browsing experience. By continuing using our website you agree to the Cookie and Privacy Policy. I agree

Источник

Оцените статью
Adblock
detector