1. 程式人生 > 其它 >Ubuntu18.04.5LTS下安裝CMake

Ubuntu18.04.5LTS下安裝CMake

Ubuntu18.04.5LTS下安裝CMake

一、安裝m4

sudo apt-get install m4

二、安裝cmake

1、從官網:https://cmake.org/download/ 中下載cmake原始碼,如cmake-3.21.1.tar.gz
2、下載後提取到一個資料夾中(也即解壓壓縮包)。然後,選擇右鍵->在終端開啟。
3、依次執行以下命令:
1. uu@uu:~/cmake-3.21.1$ ./bootstrap

圖1 第一條命令

2. uu@uu:~/cmake-3.21.1$ make

圖2 第二條命令

3. uu@uu:~/cmake-3.21.1$ sudo make install

圖3 第三條命令

4. uu@uu:~/cmake-3.21.1$ cmake --version

圖4 第四條命令

遇到的問題如下:

在執行./bootstrap命令時遇到如下兩個問題:

【問題1】:
Error when bootstrapping CMake: Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted.
【問題1的解決辦法】:sudo install gcc

【問題2】:
C++ compiler on this system is: g++ Error when bootstrapping CMake:Cannot find appropriate Makefile processor on this system.Please specify one using environment variable MAKE. Log of errors: /root/cmake-3.21.1/Bootstrap.cmk/cmake_bootstrap.log.
【問題2的解決辦法】:sudo apt-get install g++