BSP 빌드를 하다보면 간혹 CMake 버전이 문제가 될 경우가 있다. Ubuntu 18.04 기준으로 CMake는 3.10을 이용하는데, 최근 무엇인가 빌드를 위해서 CMake를 실행하면 3.12이상 버전을 사용하라면서 뱉어낸다.
$cmake . CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.12 or higher is required. You are running version 3.10.3 |
그래서 사용하는 우분투에서 cmake를 제거하고 최신 버전으로 설치하는 방법을 기술한다.
1. 기존 CMake를 제거한다.
(1) 제거는 아래와 같이 apt 또는 apt-get에서 --auto-remove 옵션을 사용한다.
$ sudo apt purge --auto-remove cmake |
(2) 서명키 사본 얻기
kitware에서 서명키 사본을 얻어온다.
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 |
2. 저장소 업데이트
apt-add-repository를 실행할 때 ubuntu 브랜치명을 이용하여 우분투 버전에 맞는 저장소를 추가한다.
(1) 저장소 결정
- 우분투 버전 20.04 (Focal Fossa) 사용자의 경우
$ sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' |
(2) 우분투 버전 18.04 (Bionic Beaver) 사용자의 경우
$ sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' Hit:5 https://download.docker.com/linux/ubuntu bionic InRelease Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease Hit:1 http://mirror.kakao.com/ubuntu bionic InRelease Hit:2 http://mirror.kakao.com/ubuntu bionic-updates InRelease Hit:3 http://mirror.kakao.com/ubuntu bionic-backports InRelease Hit:4 http://mirror.kakao.com/ubuntu bionic-security InRelease Hit:7 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease Get:8 https://apt.kitware.com/ubuntu bionic InRelease [6,801 B] Get:9 https://apt.kitware.com/ubuntu bionic/main amd64 Packages [41.5 kB] Get:10 https://apt.kitware.com/ubuntu bionic/main i386 Packages [40.9 kB] Fetched 89.2 kB in 2s (41.2 kB/s) Reading package lists... Done |
(3) 저장소 업데이트
정상적으로 저장소가 추가되었으면 저장소 업데이트를 진행한다.
$ sudo apt update ~/works/bsp/imx8mp/bsp-dart-mx8mp-master/uuu/mfgtools$ sudo apt-get update Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease Hit:2 http://mirror.kakao.com/ubuntu bionic InRelease Hit:3 http://mirror.kakao.com/ubuntu bionic-updates InRelease Hit:4 http://mirror.kakao.com/ubuntu bionic-backports InRelease Hit:5 http://mirror.kakao.com/ubuntu bionic-security InRelease Hit:7 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease Hit:8 https://apt.kitware.com/ubuntu bionic InRelease Reading package lists... Done |
3. CMake 설치와 확인
(1) CMake를 설치한다.
$ sudo apt-get install cmake Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: cmake-data Suggested packages: cmake-doc The following NEW packages will be installed: cmake cmake-data 0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded. Need to get 11.5 MB of archives. After this operation, 39.8 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 https://apt.kitware.com/ubuntu bionic/main amd64 cmake-data all 3.20.2-0kitware1 [1,834 kB] Get:2 https://apt.kitware.com/ubuntu bionic/main amd64 cmake amd64 3.20.2-0kitware1 [9,691 kB] Fetched 11.5 MB in 8s (1,421 kB/s) Selecting previously unselected package cmake-data. (Reading database ... 278372 files and directories currently installed.) Preparing to unpack .../cmake-data_3.20.2-0kitware1_all.deb ... Unpacking cmake-data (3.20.2-0kitware1) ... Selecting previously unselected package cmake. Preparing to unpack .../cmake_3.20.2-0kitware1_amd64.deb ... Unpacking cmake (3.20.2-0kitware1) ... Setting up cmake-data (3.20.2-0kitware1) ... Setting up cmake (3.20.2-0kitware1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... |
(2) 설치된 버전 확인
설치된 cmake 버전을 확인한다.
# cmake --version |
반응형
최근댓글