launchdarkly / cpp-sdks

C++ Client/Server SDKs
Other
5 stars 2 forks source link

Could not find a package configuration file provided by "boost_json" #397

Closed frankgreco closed 3 months ago

frankgreco commented 3 months ago

I can't seem to get past this error on Debian 👇🏼

3.780 CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Boost-1.81.0/BoostConfig.cmake:141 (find_package):
3.780   Could not find a package configuration file provided by "boost_json"
3.780   (requested version 1.81.0) with any of the following names:
3.780
3.780     boost_jsonConfig.cmake
3.780     boost_json-config.cmake
3.780
3.780   Add the installation prefix of "boost_json" to CMAKE_PREFIX_PATH or set
3.780   "boost_json_DIR" to a directory containing one of the above files.  If
3.780   "boost_json" provides a separate development package or SDK, be sure it has
3.780   been installed.
3.780 Call Stack (most recent call first):
3.780   /usr/lib/aarch64-linux-gnu/cmake/Boost-1.81.0/BoostConfig.cmake:262 (boost_find_component)
3.780   /usr/share/cmake-3.25/Modules/FindBoost.cmake:594 (find_package)
3.780   CMakeLists.txt:133 (find_package)
3.780
3.780
3.780 -- Configuring incomplete, errors occurred!

I'm copying commands out of the example Dockerfile (for openresty) and it fails on this command 👇🏼

RUN git clone --branch launchdarkly-cpp-server-v3.3.3 https://github.com/launchdarkly/cpp-sdks.git && \
    cd cpp-sdks && \
    mkdir build-dynamic && \
    cd build-dynamic && \
    cmake -GNinja \
        -DLD_BUILD_EXAMPLES=OFF \
        -DBUILD_TESTING=OFF \
        -DLD_BUILD_SHARED_LIBS=ON \
        -DLD_DYNAMIC_LINK_OPENSSL=ON .. && \
    cmake --build . --target launchdarkly-cpp-server && \
    cmake --install . --prefix=../../cpp-sdk-libs
cwaldren-ld commented 3 months ago

@frankgreco would you mind sharing how you fixed it in case others encounter it?

frankgreco commented 3 months ago

Unfortunately, Debian Bookworm doesn't have the right version of boost by default so I used Debian Trixie. I gave Bookworm an honest try by trying to install all of the right packages but gave up when I needed to build the boost url dependency from source.

TBH, if you're going to rely on versions of boost that isn't even in the latest stable versions of OS's like Bookworm, I'd strongly recommend providing detailed documentation on how to unblock.

frankgreco commented 3 months ago

actually @cwaldren-ld I need to use bookworm. could you provide a minimal debian example (not using trixie since it's not stable yet).

cwaldren-ld commented 3 months ago

Hi @frankgreco , I can try to help out here with a Debian example.

I get where you're coming from about depending on a recent (well, 2 years old) version of Boost. The intention was to use Boost as a one-stop shop as much as possible, rather than bringing in a bunch of other 3rd party dependencies.

The version of boost in bookworm is 4 years old. Again, not ancient history in C++ land, but missing a bunch of features. In any case, we are considering ways to relax our minimum boost version.

frankgreco commented 3 months ago

i'm okay with using the latest bookworm as long as it's possible. i've tried for two days to get it working but to no avail so any example would be nice

cwaldren-ld commented 3 months ago

Good news, I got it working 👍

I'll have an example up shortly in the Lua repo using debian:bookworm as the base image.

cwaldren-ld commented 3 months ago

It's not merged to main yet, but you can take a look at the Dockerfile in this PR: https://github.com/launchdarkly/lua-server-sdk/pull/101.

The key difference from ubuntu is these packages need to be installed:

libboost1.81-all-dev libboost-json1.81-dev libboost-url1.81-dev 
frankgreco commented 3 months ago

sweet! let me try it out!

frankgreco commented 3 months ago

@cwaldren-ld great news; that works!!! I'm running into 👇🏼

[LaunchDarkly] backing off in (3) seconds due to Service not found [asio.addrinfo:-8]
        ld_client = require('launchdarkly_server_sdk').clientInit(
            '<redacted>',
            0,
            {
                offline = false,
                logging = {
                    basic = {
                        level = 'debug'
                    },
                },
                events = {
                    enabled = false,
                },
            }
        )

but it could be unrelated

cwaldren-ld commented 3 months ago

What operating system are you building the Docker image on? Exactly what docker command are you using to build the container?

frankgreco commented 3 months ago

Actually, I was purging libboost1.81-all-dev libboost-json1.81-dev libboost-url1.81-dev after building but it looks like those are required at runtime. after removing the purge, I stopped getting that error.

I'm not getting an SSL error but I'll debug that separately.

Thanks for all of your help @cwaldren-ld! World class GitHub support 🔥