CMake Error at src/bsoncxx/CMakeLists.txt

Hello everyone,

I’m trying to build mongodb cxx driver and I followed the instructions in this link:

I have installed mongodb c driver, and libbson files are inside it
When I try to compile mongodb cxx driver, I get this error:

CMake Error at src/bsoncxx/CMakeLists.txt:98 (find_package):
  Could not find a configuration file for package "libbson-1.0" that is
  compatible with requested version "1.13.0".

  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/libbson-1.0/libbson-1.0-config.cmake, version: 1.9.2

-- Configuring incomplete, errors occurred!
See also "/usr/local/mongo-cxx-driver-r3.6.2/build/CMakeFiles/CMakeOutput.log".

my build command:

sudo cmake ..

I have mongo c driver at: /usr/local/mongo-c-driver
and libbson at: /usr/local/mongo-c-driver/src/libbson
my os is Ubuntu 18

Help me to fix the error please.

@Nujood_Ahmed, the output you provided indicates that you have libbson 1.9.2 installed under /usr/lib. This is the version that is available from the official Ubuntu package repositories for 18.04. However, that should not interfere with a properly installed C driver in another location if you specify CMake to look there. But, the fact that you say that libbson is located at /usr/local/mongo-c-driver/src/libbson seems to indicate that you have not actually built the C driver, but rather simply untarred the source code. You should review the instructions for installing the C++ driver, which have a link to the C driver installation documentation near the beginning. You will need to build and install the C driver before building the C++ driver.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.