Boost not found when building from source on RHEL 8

We run Icinga on Debian. One machine we monitor runs RHEL 8 without an active subscription. I’m trying to install the Icinga agent by compiling from source code.

Following the Development guide, I set I2_BOOST as follows:

export I2_BOOST="-DBoost_NO_BOOST_CMAKE=TRUE -DBoost_NO_SYSTEM_PATHS=TRUE -DBOOST_LIBRARYDIR=/usr/lib64 -DBOOST_INCLUDEDIR=/usr/include/boost -DBoost_ADDITIONAL_VERSIONS='1.66;1.66.0'"

The package boost-devel is installed:

[me@machine release]$ ls -l /usr/include/boost/ | head -n3
total 1552
drwxr-xr-x  5 root root  4096 Nov 17 11:05 accumulators
drwxr-xr-x  7 root root  4096 Nov 17 11:05 algorithm
[me@machine release]$ ls -l /usr/lib64/libboost_coroutine*
lrwxrwxrwx 1 root root    28 Aug  4  2020 /usr/lib64/libboost_coroutine.so -> libboost_coroutine.so.1.66.0
-rwxr-xr-x 1 root root 74584 Aug  4  2020 /usr/lib64/libboost_coroutine.so.1.66.0
[me@machine release]$

But cmake cannot find the boost libraries:

[me@machine release]$ cmake $I2_RELEASE ..
...
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message
):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR coroutine context
  date_time filesystem iostreams thread system program_options regex)
  (Required is at least version "1.66.0")

What advice can you offer to troubleshoot the “Could NOT find Boost” error?

From https://stackoverflow.com/a/17358491/50552 I learned that cmake caches environment variables in a file in the build directory. :hushed: So you have to “rm -rf release/*” before retrying.

That helped, when called with --check-system-vars, cmake finds boost:

[me@machine release]$ cmake --check-system-vars ..
-- Found Boost: /usr/include (found suitable version "1.66.0", minimum required is "1.66.0") found components: coroutine context date_time filesystem iostreams thread system program_options regex chrono atomic
1 Like