From 2967a4d6ba2983ab631589306eb25cc281ed2bf4 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sat, 30 May 2026 10:40:52 -0400 Subject: [PATCH] Require boost between 1.69 and 1.89 Why? Because from boost 1.9 onwards, shlibs are simply not available anymore. --- CMakeLists.txt | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc7a639..7be9b3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.19) +if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) +endif() project(salmanoff VERSION 0.01.001 LANGUAGES CXX) include(CMakeDependentOption) @@ -111,13 +114,27 @@ include_directories( # its own copy of boost::asio's metadata, which will cause a segfault if # boost::asio objects are used inside of a dlopen()'d library. # -# Honestly, I never liked this whole "header-only" idea so I'm happy to be rid -# of it. +# Boost.System became header-only in Boost 1.69, and Boost 1.89 removed the +# compiled stub library that older package sets still exposed as +# libboost_system. This project intentionally links Boost.System as a shared +# library to keep one Boost symbol set across the main binary and dlopen()'d +# libraries, so Boost 1.89+ is not acceptable for this build. # -# Tell CMake we're linking against the shared library (not header-only) +# Tell CMake we're linking against shared libraries, not static Boost libraries. set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_HEADER_ONLY OFF) -find_package(Boost REQUIRED COMPONENTS system log) +find_package(Boost 1.69...<1.89 REQUIRED) +if(Boost_VERSION VERSION_GREATER_EQUAL "1.89.0") + message(FATAL_ERROR + "Boost ${Boost_VERSION} was found, but salmanoff requires Boost < 1.89 " + "because Boost 1.89 removed the dynamically linkable Boost.System " + "library. Install a Boost 1.69 through 1.88 development package set " + "that provides Boost::system as a shared library. On Ubuntu 26.04, " + "install libboost1.88-dev, libboost-system1.88-dev, and " + "libboost-log1.88-dev, then clear this build directory's CMake cache " + "or configure with -DBoost_DIR=/usr/lib//cmake/Boost-1.88.0.") +endif() +find_package(Boost 1.69...<1.89 REQUIRED COMPONENTS system log) # Define BOOST_ALL_DYN_LINK project-wide to ensure all Boost libraries use dynamic linking add_compile_definitions(BOOST_ALL_DYN_LINK)