建立mongo c ++驱动程序

时间:2017-10-30 03:57:51

标签: c++ mongodb mongo-cxx-driver

在CentOs 7下,我从here克隆了驱动程序。

当我去构建它时,我收到有关libbson的错误消息。然而,libbson位于LD_LIBRARY_PATHPATH

[idf@njserver build]$ echo $LD_LIBRARY_PATH
/usr/lib64:/usr/local/lib64:/usr/local/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/local/lib:/lib64:/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib:/usr/lib64:/usr/local/lib64:/usr/local/lib:/lib64:
[idf@njserver build]$ 

路径

[idf@njserver build]$ echo $PATH
/usr/lib64:/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/idf/.local/bin:/home/idf/bin
[idf@njserver build]$ 

证明libbson位于/usr/lib64

[idf@njserver build]$ ls /usr/lib64/libbson*
/usr/lib64/libbson-1.0  /usr/lib64/libbson-1.0.so  /usr/lib64/libbson-1.0.so.0  /usr/lib64/libbson-1.0.so.0.0.0
[idf@njserver build]$

尝试构建

[idf@njserver build]$ cmake ..
-- The CXX compiler identification is GNU 6.3.1
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default is Release
-- The C compiler identification is GNU 6.3.1
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at src/bsoncxx/CMakeLists.txt:70 (find_package):
  By not providing "Findlibbson-1.0.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "libbson-1.0", but CMake did not find one.

  Could not find a package configuration file provided by "libbson-1.0"
  (requested version 1.9.0) with any of the following names:

    libbson-1.0Config.cmake
    libbson-1.0-config.cmake

  Add the installation prefix of "libbson-1.0" to CMAKE_PREFIX_PATH or set
  "libbson-1.0_DIR" to a directory containing one of the above files.  If
  "libbson-1.0" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/idf/builds/mongo-cxx-driver/build/CMakeFiles/CMakeOutput.log".
[idf@njserver build]$ 

不确定为什么会这样?

1 个答案:

答案 0 :(得分:1)

我通过编译库手动(没有yum,apt等)libbson,libmongo-c驱动程序,最后是libmongo-cpp驱动程序来解决它