From 2940938b8c059f683109ef8aa3bb098ac6f998b8 Mon Sep 17 00:00:00 2001
From: Kefu Chai <tchaikov@gmail.com>
Date: Wed, 24 Dec 2025 11:35:18 +0800
Subject: [PATCH] cmake: remove Boost::system linkage for boost 1.89+

In boost 1.89, the stub compiled library for Boost.System was removed.
According to the boost 1.89 release notes: "The stub compiled library
has been removed; System has been header-only since release 1.69.",
See https://www.boost.org/releases/1.89.0/ .

This change removes or replaces Boost::system linkage throughout the
codebase:

1. Removed "system" from BOOST_COMPONENTS in the root CMakeLists.txt,
   as the library no longer exists in boost 1.89+.

2. Where Boost::system was the only linked boost library, replaced it
   with Boost::boost (the header-only meta-target) to maintain access
   to Boost.System's header-only functionality.

3. Where other boost libraries were already linked (e.g., Boost::thread,
   Boost::regex, Boost::filesystem), removed Boost::system entirely, as
   the header-only System library dependency is automatically satisfied
   by other boost components.

This is not a breaking change since the minimum required boost version
for this project is 1.87, where Boost.System was already header-only
(only the stub compiled library remained for compatibility).

Signed-off-by: Kefu Chai <kchai@redhat.com>
---
 CMakeLists.txt                          |  2 +-
 src/CMakeLists.txt                      |  1 -
 src/test/common/CMakeLists.txt          | 24 ++++++++++++------------
 src/test/lazy-omap-stats/CMakeLists.txt |  2 +-
 src/test/mon/CMakeLists.txt             |  2 +-
 src/test/neorados/CMakeLists.txt        |  2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index abb0e725ff881..0e0cb08a27a94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -741,7 +741,7 @@ option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
 
 # Boost::thread depends on Boost::atomic, so list it explicitly.
 set(BOOST_COMPONENTS
-  atomic chrono thread system regex random program_options date_time
+  atomic chrono headers thread regex random program_options date_time
   iostreams context coroutine url)
 set(BOOST_HEADER_COMPONENTS container)
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7a4a8acc5df0d..871d0aee18c77 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -588,7 +588,6 @@ set(ceph_common_deps
   common_utf8 extblkdev arch crc32
   ${LIB_RESOLV}
   Boost::thread
-  Boost::system
   Boost::random
   Boost::program_options
   Boost::date_time
diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt
index 50ebf9166c123..c2190d7e9813e 100644
--- a/src/test/common/CMakeLists.txt
+++ b/src/test/common/CMakeLists.txt
@@ -379,44 +379,44 @@ add_ceph_unittest(unittest_hobject)
 
 add_executable(unittest_async_completion test_async_completion.cc)
 add_ceph_unittest(unittest_async_completion)
-target_link_libraries(unittest_async_completion ceph-common Boost::system)
+target_link_libraries(unittest_async_completion ceph-common Boost::headers)
 
 
 add_executable(unittest_async_max_concurrent_for_each test_async_max_concurrent_for_each.cc)
 add_ceph_unittest(unittest_async_max_concurrent_for_each)
-target_link_libraries(unittest_async_max_concurrent_for_each ceph-common Boost::system Boost::context)
+target_link_libraries(unittest_async_max_concurrent_for_each ceph-common Boost::boost Boost::context)
 
 if(NOT WIN32)
 add_executable(unittest_async_co_spawn_group test_async_co_spawn_group.cc)
 add_ceph_unittest(unittest_async_co_spawn_group)
-target_link_libraries(unittest_async_co_spawn_group ceph-common Boost::system)
+target_link_libraries(unittest_async_co_spawn_group ceph-common Boost::boost)
 
 add_executable(unittest_async_co_throttle test_async_co_throttle.cc)
 add_ceph_unittest(unittest_async_co_throttle)
-target_link_libraries(unittest_async_co_throttle ceph-common Boost::system)
+target_link_libraries(unittest_async_co_throttle ceph-common Boost::boost)
 endif(NOT WIN32)
 
 add_executable(unittest_async_shared_mutex test_async_shared_mutex.cc)
 add_ceph_unittest(unittest_async_shared_mutex)
-target_link_libraries(unittest_async_shared_mutex ceph-common Boost::system)
+target_link_libraries(unittest_async_shared_mutex ceph-common Boost::boost)
 
 
 add_executable(unittest_async_spawn_throttle test_async_spawn_throttle.cc)
 add_ceph_unittest(unittest_async_spawn_throttle)
-target_link_libraries(unittest_async_spawn_throttle ceph-common Boost::system Boost::context)
+target_link_libraries(unittest_async_spawn_throttle ceph-common Boost::boost Boost::context)
 
 add_executable(unittest_async_yield_waiter test_async_yield_waiter.cc)
 add_ceph_unittest(unittest_async_yield_waiter)
-target_link_libraries(unittest_async_yield_waiter ceph-common Boost::system Boost::context)
+target_link_libraries(unittest_async_yield_waiter ceph-common Boost::boost Boost::context)
 
 
 add_executable(unittest_async_parallel_for_each test_async_parallel_for_each.cc)
 add_ceph_unittest(unittest_async_parallel_for_each)
-target_link_libraries(unittest_async_parallel_for_each ceph-common Boost::system)
+target_link_libraries(unittest_async_parallel_for_each ceph-common Boost::boost)
 
 add_executable(unittest_async_spawn_group test_async_spawn_group.cc)
 add_ceph_unittest(unittest_async_spawn_group)
-target_link_libraries(unittest_async_spawn_group ceph-common Boost::system)
+target_link_libraries(unittest_async_spawn_group ceph-common Boost::boost)
 
 add_executable(unittest_cdc test_cdc.cc
   $<TARGET_OBJECTS:unit-main>)
@@ -437,7 +437,7 @@ add_ceph_unittest(unittest_fault_injector)
 
 add_executable(unittest_blocked_completion test_blocked_completion.cc)
 add_ceph_unittest(unittest_blocked_completion)
-target_link_libraries(unittest_blocked_completion Boost::system GTest::GTest)
+target_link_libraries(unittest_blocked_completion Boost::boost GTest::GTest)
 
 add_executable(unittest_allocate_unique test_allocate_unique.cc)
 add_ceph_unittest(unittest_allocate_unique)
@@ -492,14 +492,14 @@ set_tests_properties(unittest_decode_start_v_checker_expect_failure
 endif(0)
 
 add_executable(unittest_async_call test_async_call.cc)
-target_link_libraries(unittest_async_call ceph-common Boost::system
+target_link_libraries(unittest_async_call ceph-common Boost::boost
   GTest::GTest)
 add_ceph_unittest(unittest_async_call)
 
 
 add_executable(unittest_librados_completion test_librados_completion.cc)
 target_link_libraries(unittest_librados_completion librados ceph-common
-  Boost::system GTest::GTest)
+  Boost::boost GTest::GTest)
 add_ceph_unittest(unittest_librados_completion)
 
 add_executable(unittest_async_cond test_async_cond.cc)
diff --git a/src/test/lazy-omap-stats/CMakeLists.txt b/src/test/lazy-omap-stats/CMakeLists.txt
index 2143a092f27e8..93ddc03a248cd 100644
--- a/src/test/lazy-omap-stats/CMakeLists.txt
+++ b/src/test/lazy-omap-stats/CMakeLists.txt
@@ -4,7 +4,7 @@ add_executable(ceph_test_lazy_omap_stats
   main.cc
   lazy_omap_stats_test.cc)
 target_link_libraries(ceph_test_lazy_omap_stats
-  librados Boost::system Boost::regex ceph-common ${UNITTEST_LIBS})
+  librados Boost::regex ceph-common ${UNITTEST_LIBS})
 install(TARGETS
   ceph_test_lazy_omap_stats
   DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/src/test/mon/CMakeLists.txt b/src/test/mon/CMakeLists.txt
index 8c271407e9828..5601ca4b890fe 100644
--- a/src/test/mon/CMakeLists.txt
+++ b/src/test/mon/CMakeLists.txt
@@ -57,7 +57,7 @@ target_link_libraries(unittest_mon_montypes mon global)
 # ceph_test_mon_memory_target
 add_executable(ceph_test_mon_memory_target
   test_mon_memory_target.cc)
-target_link_libraries(ceph_test_mon_memory_target Boost::system Threads::Threads)
+target_link_libraries(ceph_test_mon_memory_target Boost::boost Threads::Threads)
 set_target_properties(ceph_test_mon_memory_target PROPERTIES
   SKIP_RPATH TRUE
   INSTALL_RPATH "")
diff --git a/src/test/neorados/CMakeLists.txt b/src/test/neorados/CMakeLists.txt
index 968ef609cdca7..f5f63e18b1c6a 100644
--- a/src/test/neorados/CMakeLists.txt
+++ b/src/test/neorados/CMakeLists.txt
@@ -11,7 +11,7 @@ target_link_libraries(ceph_test_neorados_start_stop global libneorados
   ${unittest_libs})
 
 add_executable(ceph_test_neorados_completions completions.cc)
-target_link_libraries(ceph_test_neorados_completions Boost::system pthread
+target_link_libraries(ceph_test_neorados_completions Boost::boost pthread
   ${unittest_libs})
 
 add_executable(ceph_test_neorados_op_speed op_speed.cc)
