Search code examples
c++linuxboostcmakerippled

boost_chrono_FOUND to FALSE so package "boost_chrono" is considered to be NOT FOUND


I am trying to build ripple by following the build guide on GitHub, but boost is continuously throwing some unknown error. Boost is installed and running. I installed boost_1_71_0 as described by the build guide.

/home/usman/Downloads/clion-2020.1.2/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/usman/Desktop/ripple/rippled
-- Using 4 cores for ExternalProject builds.
-- rippled version: 1.6.0
-- NIH-EP cache path: /home/usman/Desktop/ripple/rippled/.nih_c/unix_makefiles/GNU_9.3.0/Debug
-- using [01bd5a2646cda78ee09d2067c287c8f89872736d] as build container tag...
-- docker local user id: 1000
-- docker local group id: 1000
-- BOOST_ROOT: /usr/local
-- BOOST_LIBRARYDIR: /usr/local/lib/
CMake Error at /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/boost_chrono-1.71.0/boost_chrono-config.cmake

  but it set boost_chrono_FOUND to FALSE so package "boost_chrono" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_chrono.so.1.71.0 (shared, Boost_USE_STATIC_LIBS=ON)

  * libboost_chrono.a (shared runtime, Boost_USE_STATIC_RUNTIME=ON)

Call Stack (most recent call first):
  /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
  Builds/CMake/deps/FindBoost.cmake:273 (find_package)
  Builds/CMake/deps/Boost.cmake:50 (find_package)
  CMakeLists.txt:43 (include)


-- Configuring incomplete, errors occurred!
See also "/home/usman/Desktop/ripple/rippled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/usman/Desktop/ripple/rippled/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

Solution

  • There is a similar question here, but your issue appears to be the opposite case.

    The important section of the error is here:

    No suitable build variant has been found.
    
    The following variants have been tried and rejected:
    
    * libboost_chrono.so.1.71.0 (shared, Boost_USE_STATIC_LIBS=ON)
    
    * libboost_chrono.a (shared runtime, Boost_USE_STATIC_RUNTIME=ON)
    

    It shows you what libraries were found, and even gives the reason why they were rejected. All of the libraries found on your machine are shared libraries. However, your CMake configuration indicates you do not want to use shared libraries (Boost_USE_STATIC_LIBS=ON and Boost_USE_STATIC_RUNTIME=ON). To fix the error, you have two options:

    1. Set Boost_USE_STATIC_LIBS to OFF and Boost_USE_STATIC_RUNTIME to OFF:

       set(Boost_USE_STATIC_LIBS OFF)
       set(Boost_USE_STATIC_RUNTIME OFF)
       find_package(Boost ... )
      
    2. Build the static Boost libraries also, so not only the shared libraries are available on your machine.