CMake高版本安装(踩坑)

安装步骤

  1. 查看当前cmake版本:
cmake -version
  1. 卸载当前cmake:(如果安装了ROS跳过此步)
sudo apt remove cmake
  1. 下载cmake:
    可直接从cmake官网下载新版本,也可执行如下语句:(要哪个版本只要更改版本号就行)
wget http://www.cmake.org/files/v3.16/cmake-3.22.0.tar.gz
  1. 解压,进入目录
tar xf cmake-3.22.0.tar.gz
cd cmake-3.22.0
  1. 进入文件夹后执行

Linux 使用 bootstrap.sh 来生产编译工具 b2 . 同时可以配置安装路径 , 默认的安装路径是 /usr/local,需更改路径可自行查阅资料

./bootstrap
  1. 安装
  • 注:

make可使用make -j4或make -j8提升速度,一般来说双核能够用j4,j8对配置要求高

make && make install

安装踩坑

  1. 其中一个报错忘记记录下来了,不过解决的办法是要先下载gcc,gcc-c++(作者是先更新了这个,不知道用yum下载的低版本好不好用)
yum -y install gcc
yum -y install gcc-c++
  1. 使用./bootstrap出错
-- Looking for gethostname
-- Looking for gethostname - found
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) 
CMake Error at Utilities/cmcurl/CMakeLists.txt:454 (message):
  Could not find OpenSSL.  Install an OpenSSL development package or
  configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.


-- Configuring incomplete, errors occurred!
See also "/home/whlg/cmake-3.16.6/CMakeFiles/CMakeOutput.log".
See also "/home/whlg/cmake-3.16.6/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------

解决办法,下载OpenSSL
CentOS命令yum install openssl-devel
ubuntu命令:yum install libssl-dev

猜你喜欢

转载自blog.csdn.net/weixin_57663206/article/details/127318712