Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-583

Allow shared-only system libbson

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      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.

            Assignee:
            colby.pike@mongodb.com Colby Pike
            Reporter:
            tharvik@gmail.com Valérian Rousset
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: