I install in accordance with https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-%28New-Driver%29

Driver C installs great. At the stage of installing the C ++ driver (cmake) writes:

CMake Error at cmake/FindLibBSON.cmake:23 (message): Don't know how to find libbson; please set LIBBSON_DIR to the prefix directory with which libbson was configured. 

Where, how to install this damned LIBBSON_DIR? Googling, but seeing no one else with LIBBSON_DIR had any problems, in Google there are no answers at all to "LIBBSON_DIR".

Libson libraries themselves are available (in / usr / lib), but no matter how LIBBSON_DIR set them, they are all the same

    2 answers 2

    Successfully installed and used the so-called Legacy Driver. The one mentioned in the question is still unstable and poorly documented. Installation instructions: https://github.com/mongodb/mongo-cxx-driver/wiki/Download-and-Compile-the-Legacy-Driver

    I want to draw attention to the rake!

    When compiling a driver using scons, for some reason, the default option is to "take warnings as an error", which prevents the entire project from being compiled, as it contains a warning that the variable is initialized but not used. In general, you must specify the --disable-warnings-as-errors option when compiling. In addition, the application in C ++ (using the driver) was compiled, but did not work until I recompiled the driver with an explicit reference to C ++ 11, that is, the command line looked like this:

     scons --disable-warnings-as-errors --prefix=$HOME/mongo-client-install --c++11=on install 

    and everything worked fine! Otherwise, you can safely trust the instructions.

      The new C ++ driver is already quite stable, so I see no reason not to use it. As it is written in the instructions, to build a C ++ driver, you must first build libbson and mongo-c-driver . I have them going to the same folder (option -DCMAKE_INSTALL_PREFIX=<path> ). Further, when building a C ++ driver, we specify this path (s) in the parameters:

       cd mongo-cxx-driver cmake [...] -DLIBBSON_DIR=<path-to-libbson-build-dir> -DLIBMONGOC_DIR=<path-to-mongo-c-driver-build-dir>