ccc icon indicating copy to clipboard operation
ccc copied to clipboard

Build fails with Boost 1.89.0 (proposed solution included)

Open ctench opened this issue 6 months ago • 1 comments

Much credit to user @cho-m for writing up a similar issue - a lot of the text here will be informed by their post.

Issue Description (heavily paraphrasing cho-m's post)

In the release for Boost 1.89.0, developers removed the Boost.System stub library introduced in version 1.69[^1]. Trying to build the CCC textbook examples with Boost 1.89, therefore, fails, since CCC code expects the Boost.System stub library to be present.

I could not reproduce this error with Boost 1.85 installed instead, which is the latest older version of Boost I could easily install.

Setup Details

Expected Behavior

Running cmake .. as part of the README setup instructions should generate chapter_* folders for each chapter folder in the root directory of ccc, with custom Makefiles included in each.

Actual Behavior

cmake .. fails:

CMake Error at /opt/homebrew/lib/cmake/Boost-1.89.0/BoostConfig.cmake:141 (find_package):
  Could not find a package configuration file provided by "boost_system"
  (requested version 1.89.0) with any of the following names:

    boost_systemConfig.cmake
    boost_system-config.cmake

  Add the installation prefix of "boost_system" to CMAKE_PREFIX_PATH or set
  "boost_system_DIR" to a directory containing one of the above files.  If
  "boost_system" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/Boost-1.89.0/BoostConfig.cmake:262 (boost_find_component)
  /opt/homebrew/share/cmake/Modules/FindBoost.cmake:609 (find_package)
  CMakeLists.txt:28 (find_package)

Reproduction Steps

Tested only on the MacOS version listed above.

  1. Install homebrew 4.6.17 (I used the .pkg file here)
  2. Install cmake 4.1.2 via brew install cmake
  3. Install Boost 1.89.0 via brew install boost
  4. Run the commands in the README:
cd ccc
git submodule init
git submodule update
mkdir build
cd build
cmake ..

Proposed Solution

I was able to get cmake .. to run successfully by removing the word system from this line in the root directory's CMakeLists.txt: https://github.com/JLospinoso/ccc/blob/b9723235c2a04aca081f5b8e404797f401c5fc71/CMakeLists.txt#L28

To be as clear as possible, my line 28 reads:

find_package(Boost COMPONENTS regex date_time filesystem unit_test_framework program_options REQUIRED)

This should work for anyone using Boost 1.69 or above, but I've only tested this on Boost 1.89. If there's any worry about maintaining the search for the Boost.System stub, the following can be added as line 29 (I've tested this on my setup and it does no harm):

find_package(Boost COMPONENTS system OPTIONAL)

This will search for the Boost.System library, and won't halt the build if the search fails.

With that addition, the build again succeeds with nearly identical console output, the only difference being the addition of this line:

-- Could NOT find Boost: missing: system (found /opt/homebrew/lib/cmake/Boost-1.89.0/BoostConfig.cmake (found version "1.89.0"))

If such a change is adopted, anyone using a version of Boost older than 1.69 will have a weaker guarantee that Boost.System is present on their machine. That said, Boost 1.69 was released in April of 2019. Perhaps it'd be appropriate to ask anyone in that category to consider updating to a later version of Boost 😄

[^1]: As part of Boost 1.69, Boost.System was converted from a fully-built library to a header-only library, so users were not required to link against it. For convenience, developers at the time added an empty stub of a library for Boost.System, so systems depending on that library's presence wouldn't break. Release notes for Boost 1.69 reference the stub's creation.

ctench avatar Oct 18 '25 01:10 ctench

I can confirm, that your fix also works for older Boost versions. 👍 Tested with libboost 1.83 on Debian 13 building radiotray-ng.

bugtracker2019 avatar Oct 22 '25 17:10 bugtracker2019