[MONGOCRYPT-583] Allow shared-only system libbson Created: 30/Jul/23  Updated: 12/Oct/23

Status: Backlog
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Unknown
Reporter: Valérian Rousset Assignee: Colby Pike
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-4705 Better control over static/dynamic co... Closed

 Description   

I'm currently trying to package libmongocrypt for Gentoo, and I'm having some issue with using the system bson instead of the localy built: cmake/ImportBSON.cmake loads both static and dynamic library regardless of the value -DUSE_SHARED_LIBBSON. This disallow building with a shared-only libbson (such as when building it with -DENABLE_STATIC=OFF).

The repro I'm using (Gentoo w/ dev-libs/libbson[-static-libs]), but as that might not be your system, you can trigger another quite related error by only keeping -DMONGOCRYPT_MONGOC_DIR=USE-SYSTEM

#!/bin/sh -eu
cmake \
    -DENABLE_ONLINE_TESTS=OFF \
    -DMONGOCRYPT_MONGOC_DIR=USE-SYSTEM \
    -DUSE_SHARED_LIBBSON=ON
make stubbed-crypt_shared # faster than full make

IMO the issue arises from a misuse of MONGOCRYPT_MONGOC_DIR; you can see the problem iff its value is USE-SYSTEM but the other flags aren't set: it will default to local build and add_subdirectory("USE-SYSTEM") which is clearly wrong.

I've managed to put a PR fixing that at https://github.com/mongodb/libmongocrypt/pull/681 commenting there more on the code side.


Generated at Thu Feb 08 09:09:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.