从源码安装cmake

##安装环境:ubuntu16.04

## 安装cmake之前需要确认已经安装make、gcc、g++,用make -v | gcc -v | g++ -v可查看是否已经安装,如果没有安装用apt-get安装一下(也可从源码安装)

sudo apt-get install gcc

sudo apt-get install g++

sudo apt-get install make

## cmake下载:https://cmake.org/download/

wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.zip

wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz

注:

源码安装cmake-3.14-3的时候碰到了一些无法解决的错误,贴到了随笔最后,有解决的伙伴可以给个方法

下面直接安装cmake-3.13.4

##cmake解压: tar -zxvf cmake-3.13.4.tar.gz

##cmake安装

step1:./bootstrap

step2:make

step3:make install

step4:cmake --version

如下安装成功:

 

 step5<可选>: make uninstall

##问题记录

1 cmake-3.14.3.zip解压完成后,cd cmake-3.14.3; chmod 775 ./configure; ./configure报错如下:

./configure: 3: exec: /home/guang/3rdTools/cmake-3.14.3/bootstrap: Permission denied

解决:需要首先执行bootstrap(没有进一步研究为什么,网络上给的答案)

chmod 775 bootstrap

./bootstrap

执行./bootstrap报错,还未找到答案

[18:09:54]In file included from /home/guang/3rdTools/cmake-3.14.3/Source/cmExportFileGenerator.h:11:0,
[18:09:54] from /home/guang/3rdTools/cmake-3.14.3/Source/cmExportTryCompileFileGenerator.h:8,
[18:09:54] from /home/guang/3rdTools/cmake-3.14.3/Source/cmCoreTryCompile.cxx:13:
[18:09:54]/home/guang/3rdTools/cmake-3.14.3/Bootstrap.cmk/cmVersionConfig.h:4:23: warning: missing terminating " character
[18:09:54]"34efine CMake_VERSION "3
[18:09:54] ^
[18:09:54]/home/guang/3rdTools/cmake-3.14.3/Bootstrap.cmk/cmVersionConfig.h:7:1: warning: missing terminating " character
[18:09:54]/home/guang/3rdTools/cmake-3.14.3/Bootstrap.cmk/cmVersionConfig.h:7:1: error: missing terminating " character
[18:09:55]/home/guang/3rdTools/cmake-3.14.3/Bootstrap.cmk/cmVersionConfig.h:5:1: error: expected unqualified-id before numeric constant
[18:09:55]Makefile:56: recipe for target 'cmCoreTryCompile.o' failed
[18:09:55]make: *** [cmCoreTryCompile.o] Error 1
[18:09:55]---------------------------------------------
[18:09:55]Error when bootstrapping CMake:
[18:09:55]Problem while running make
[18:09:55]---------------------------------------------
[18:09:55]Log of errors: /home/guang/3rdTools/cmake-3.14.3/Bootstrap.cmk/cmake_bootstrap.log
[18:09:55]---------------------------------------------

猜你喜欢

转载自www.cnblogs.com/leeguang/p/10849584.html
今日推荐