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
- 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).
- 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
- 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.