在CentOS上利用cmake编译时提示版本过低,在利用yum remove cmake -y移除原来版本后,现将安装指定版本cmake的方法整理如下:
- 输入指定版本的cmake
wget https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1.tar.gz
- 解压
tar -xvf cmake-3.17.1.tar.gz
- 进行配置(./bootstrap 等同于 ./configure)
./bootstrap
---------------------------------------------
CMake 3.17.1, Copyright 2000-2020 Kitware, Inc. and Contributors
---------------------------------------------
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.
---------------------------------------------
Log of errors: /home/centos/cmake-3.17.1/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
提示缺少gcc
sudo yum install gcc
再次配置提示缺少gcc-c++,同样的解决方法
---------------------------------------------
CMake 3.17.1, Copyright 2000-2020 Kitware, Inc. and Contributors
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/LevelDB/cmake-3.17.1/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
sudo yum install gcc-c++
再次配置提示缺少make
---------------------------------------------
CMake 3.17.1, Copyright 2000-2020 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc
C++ compiler on this system is: g++ -std=gnu++1y
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate Makefile processor on this system.
Please specify one using environment variable MAKE.
---------------------------------------------
Log of errors: /usr/local/LevelDB/cmake-3.17.1/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
再次配置提示缺少OpenSSL
---------------------------------------------
gmake: “cmake”是最新的。
loading initial cache file /usr/local/LevelDB/cmake-3.17.1/Bootstrap.cmk/InitialCacheFlags.cmake
-- 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 "/usr/local/LevelDB/cmake-3.17.1/CMakeFiles/CMakeOutput.log".
See also "/usr/local/LevelDB/cmake-3.17.1/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
通过gmake 编译安装
sudo gmake
最后一步
sudo gmake install
- 查看当前cmake版本
cmake -version