Skip to content

Fix windows build errors with boost 1.88.0 #10419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yhabteab
Copy link
Member

Boost 1.88.0 introduced a feature 1 that makes use of the Windows API, so we need to link against the psapi library. Actually, that new feature can also be disabled by setting the BOOST_STACKTRACE_DISABLE_OFFSET_ADDR_BASE macro, but since it seems to be a useful feature and isn't even disabled by default, it's better to add the missing library to the linker flags instead of disabling it.

Note: The reason why we're linking statically (psapi.lib) instead of dynamically (psapi.dll) is that we've already set boost to link statically here, so we need to do the same for psapi.

icinga2/CMakeLists.txt

Lines 135 to 136 in 520aed6

if(WIN32)
set(Boost_USE_STATIC_LIBS ON)

fixes #10412

Footnotes

  1. https://github.com/boostorg/stacktrace/pull/200

@yhabteab yhabteab added the area/windows Windows agent and plugins label Apr 23, 2025
@cla-bot cla-bot bot added the cla/signed label Apr 23, 2025
@jschmidt-icinga
Copy link
Contributor

Have you tested if this is still required on windows with cmake_policy(SET CMP0167 NEW) before find_package(Boost ...?

Currently when running cmake we're getting the warning that the policy is not set which means that we're using cmake's FindBoost module instead of boost's BoostConfig.cmake. The help page to this policy explicitly mentions better support of new boost versions.

When going through BoostConfig.cmake I can't see anything that explicitly links psapi.lib, but I don't entirely understand the process by which it finds the dependencies of the individual components either.

@yhabteab
Copy link
Member Author

Have you tested if this is still required on windows with cmake_policy(SET CMP0167 NEW) before find_package(Boost ...?

No, I didn't but even then we can't use it here. The CMake docs for it says this:

Upstream Boost 1.70 and above provide a BoostConfig.cmake package configuration file. find_package(Boost CONFIG) finds the upstream package directly, without the find module.

And our minimum supported Boost version is 1.66.

set(BOOST_MIN_VERSION "1.66.0")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/windows Windows agent and plugins cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Boost 1.88 on Windows
2 participants