CMake high version installation (stepping on the pit)

installation steps

  1. Check the current cmake version:
cmake -version
  1. Uninstall the current cmake: (skip this step if ROS is installed)
sudo apt remove cmake
  1. Download cmake: You can download the new version
    directly from the cmake official website , or you can execute the following statement: (just change the version number for which version you want)
wget http://www.cmake.org/files/v3.16/cmake-3.22.0.tar.gz
  1. Unzip and enter the directory
tar xf cmake-3.22.0.tar.gz
cd cmake-3.22.0
  1. Execute after entering the folder

Linux uses bootstrap.sh to produce the compilation tool b2. At the same time, you can configure the installation path. The default installation path is /usr/local. If you need to change the path, you can check the information yourself

./bootstrap
  1. Install
  • Note:

Make can use make -j4 or make -j8 to increase the speed. Generally speaking, dual-core can use j4 and j8 to have high configuration requirements.

make && make install

Install the pit

  1. I forgot to record one of the error reports, but the solution is to download gcc, gcc-c++ first (the author updated this first, I don’t know if the lower version downloaded with yum is easy to use)
yum -y install gcc
yum -y install gcc-c++
  1. Error using ./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
---------------------------------------------

Solution, download OpenSSL ,
CentOS command yum install openssl-devel
ubuntu command:yum install libssl-dev

Guess you like

Origin blog.csdn.net/weixin_57663206/article/details/127318712