4

I am trying to deploy some libraries on embedded SPARC-like machine for project in which I involved. I successfully built bleeding-edge Boost library on this machine and installed it into /util directory. Then I tried to write simple tester script for CMake. Here is the beginning of this script:

cmake_minimum_required(VERSION 2.8.3)
project(cpp_boost_test)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(console_bridge REQUIRED)
message(STATUS "Boost Includes: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost Libraries: ${Boost_LIBRARIES}")

While running I receive the following error message:

-- Found Boost 1.70.0 at /util/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS
     system;thread
-- Found boost_headers 1.70.0 at /util/lib/cmake/boost_headers-1.70.0
-- Found boost_system 1.70.0 at /util/lib/cmake/boost_system-1.70.0
-- No suitable boost_system variant has been identified!
--   libboost_system.so.1.70.0 (shared, BUILD_SHARED_LIBS not ON, set Boost_USE_STATIC_LIBS=OFF to override)
CMake Error at /util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:60 (find_package):
      Found package configuration file:

      /util/lib/cmake/boost_system-1.70.0/boost_system-config.cmake

      but it set boost_system_FOUND to FALSE so package "boost_system" is considered to be NOT FOUND.
      Reason given by package:
      No suitable build variant has been found.
Call Stack (most recent call first):
   /util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:89 (boost_find_dependency)
   /util/share/cmake-3.7/Modules/FindBoost.cmake:229 (find_package)
 CMakeLists.txt:4 (find_package)

I tried to set Boost_USE_STATIC_LIBS option but the error still remains.

Can this be a version conflict in Boost.System or not? What should I do to avoid this error? It is not possible to remove Boost from project, so I can not accept an answer about such removal...

Andrei Vukolov
  • 118
  • 1
  • 10
  • The problem seems to be your CMake is too old (I guessed 3.7 from the path). Boost 1.70.0 is bleeding edge and CMake does not know about it in its FindBoost.cmake module. First CMake version that is aware of Boost 1.70 is 3.14 that was released a few days ago. – vre Mar 18 '19 at 11:18
  • 2
    I have the same issue building for ARM. Even with cmake 3.14.0 I have the same issue. When setting "SET(Boost_DEBUG ON)" you can see what happens in more detail. It fails to find either a shared or a static library. When setting SET(BUILD_SHARED_LIBS ON) it does succeed in making the makefiles, but more issues turn up. (For example, it still fails to set Boost_SYSTEM_LIBRARY). Seems incompatibilty issues with cmake and the latest boost indeed – Arnout Mar 26 '19 at 09:06

2 Answers2

2

I investigated the history of changes in Boost, so the answer is that building dependencies in projects linking Boost should be manually included into CMake (see answers here: CMake finds Boost but the imported targets not available for Boost version for details). Thus it is mandatory to use Boost version that is slightly older than CMake version you use. I solved my problem with rollback to Boost 1.61 (according to peculiarities of my embedded platform I can not compile CMake version above 3.7.0).

Andrei Vukolov
  • 118
  • 1
  • 10
1

Check the version of your current cmake installation by using cmake --version.

It's highly likely greater than 3.0. Since there is an incompatibility between old cmake and modern cmake (>3.0), you can try to fix it by change the VERSION to your current cmake's version or any number >= 3.0.

liakoyras
  • 1,101
  • 12
  • 27
Winkee
  • 51
  • 3