Mongodb C++ 编译问题

Mongodb C++ compilation issue

我正在尝试为 C++ 编译 mongodb 驱动程序并遵循 url 中给出的说明:Mongocxx

我遇到以下错误:

-- The CXX compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking for module 'libbson-1.0>=1.5.0'
-- 

CMake Error at /usr/share/cmake3/Modules/FindPkgConfig.cmake:424 (message):
A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake3/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
 cmake/FindLibBSON.cmake:33 (pkg_check_modules)
 src/bsoncxx/CMakeLists.txt:67 (find_package)


-- Configuring incomplete, errors occurred!
    See also "/data/2/nirmal/mongo_cpp/mongo-cxx-
    driver/build/CMakeFiles/CMakeOutput.log".

我检查过 libbson 已经安装在 /usr/local/bin 中。 无法找出根本原因。 请协助。

如果您正在构建版本 3.1.X 或 3.0.x,您必须指定 libmongoc(mongodb c 驱动程序)安装的 libbson。

"Users building mongocxx versions 3.1.x and 3.0.x should specify the libmongoc installation directory by using the -DLIBMONGOC_DIR and -DLIBBSON_DIR options to cmake. See the following example, which assumes that both libmongoc and libbson are installed into /your/cdriver/prefix:"

如果您在 linux 系统上构建,请尝试这样的操作:

cmake -DCMAKE_BUILD_TYPE=发布 -DCMAKE_INSTALL_PREFIX=/usr/local .. -DBSONCXX_POLY_USE_MNMLSTC=1 -DLIBMONGOC_DIR=/usr -DLIBBSON_DIR=/usr/lib64

可以找到更详细的信息https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/