##安裝環境: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.tar.gz #該方法下載較慢,建議從瀏覽器直接下載
注:
源碼安裝cmake-3.14-3的時候碰到了一些無法解決的錯誤,貼到了隨筆最后,有解決的伙伴可以給個方法(已解決,原因是壓縮包下載錯誤)
##cmake解壓: tar -zxvf cmake-3.13.4.tar.gz / tar -zxvf cmake-3.14.3.tar.gz
##cmake安裝
step1:./bootstrap
step2:make
step3:make install
step4:cmake --version
如下安裝成功:
3.13.4安裝成功
3.14.3安裝成功
step5<可選>: make uninstall #卸載(我將3.13.4版本的卸載了,保留了3.14.3的)
##問題記錄(該問題后來定位是zip的壓縮包是用於windows版本的,還是要注意看清楚每一行英文,我暈,下載tar.gz版本即可,如下錯誤不關注,留下給自己提個醒)
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]---------------------------------------------