MongoDB Database cxx Driver compilation

Source: Internet
Author: User
Tags creative commons attribution mongoclient

Recent project needs, want to test MongoDB read and write a large number of small pictures speed (Simple file system IO efficiency is low, want to try NoSQL can speed up), because using C + + development, so using MongoDB cxx driver, need to compile themselves, the following record the entire compilation process

  1. CXX driver Download

    Download the Https://github.com/mongodb/mongo-cxx-driver/tree/26compat from the GitHub official source, because I need a stable drive, so choose the 26compat branch. Then compile with the official compilation Guide (https://github.com/mongodb/mongo-cxx-driver/wiki/Download%20and%20Compile).

  2. Dependency Download and compilation

    Depending on the official compilation instructions, you need the following dependencies, which you need to download

    • C + + compiler: This does not need to say, certainly need, as long as the installation of MSVC will certainly have
    • BOOST: the famous C + + development library, quasi C + + standard library, official website http://www.boost.org/, I downloaded the 1.55 version, the specific compilation and use of methods online a lot. I use the root directory directly under the Bootstrap.bat build B2.exe, and then "B2" directly compiles the entire library, quite a time, Khan a
    • Python: Mainly to use the scons described below, because I use the Scons2.3.1 version does not support python3+, so I downloaded the python2.7 version, https://www.python.org/, I directly download the MSI installation file installation, when installed note tick the Add Python to system path option
    • SCons: According to the introduction, this goods is similar to the existence of cmake, do not know why do not apply CMake and use this. , the official website http://scons.org/, I downloaded is 2.3.1 version, the installation method is very simple, according to the root directory of "README.txt", open the Command Line window under the root directory, enter the following command
    Python setup.py Install
  3. CXX Driver Compilation

Open the VS2010 command-line compilation tool, switch to the root of the cxx driver, and compile with the following command:

SCons--use-system-boost--32--sharedclient--dynamic-windows--prefix= $HOME/mongo-client-install Install-mongoclient--cpppath= "D:\Dev\boost_1_55_0"--libpath= "D:\Dev\boost_1_55_0\stage\lib"--full Install-mongoclient

Note The prefix option indicates the location of the last generated library installation, Cpppath and libpath represent the position of the boost library, please modify it to suit your needs, and other options refer to the official compilation instructions to modify "https://github.com/mongodb/ Mongo-cxx-driver/wiki/download%20and%20compile "

Spit Groove A sentence, the official command line completely not, always prompt install-mongoclient error, visual not add this option is completely without the development of the library installation (that is, h files and Lib files extracted into a folder), how to play.


This work is licensed under the Creative Commons Attribution-NonCommercial use-Share 4.0 International license agreement in the same way.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.