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
2. uu@uu:~/cmake-3.21.1$ make
3. uu@uu:~/cmake-3.21.1$ sudo make install
4. uu@uu:~/cmake-3.21.1$ cmake --version
遇到的问题如下:
在执行./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++