Compiling MongoDB C + + driver details using VS2010

Source: Internet
Author: User
Tags mongodb driver windows x86 python script



Recently, in order to resolve the need for high-speed write and multi-document type support for IM message logging, we decided to use MongoDB to resolve it.



Considering that MongoDB has a higher requirement vs version, incompatible with my existing VS version, in Leveldb, Ssdb, Redis, HBase and other nosql relays a lap, and finally chose MongoDB, should have that sentence: No best, only the most suitable.



MongoDB because of the use of new features of C + +, the official recommended to use VS2013 to compile, minimum requirements VS2010.



MongoDB C + + driver compilation process is more complex, the official does not provide a compiled driver package, the online compilation version of the data are older, hereby collate the latest MongoDB C + + driver compilation method.



To compile MongoDB C + + driver details using VS2010:



1. Download the Python 2.7.9 installer (do not use 3. x version), using 32-bit because scons only has 32-bit installation packages available;



: https://www.python.org/downloads/Select: Windows x86 MSI Installer



2, download SCons 2.3.4,mongodb driver is built with SCons, after installation will be automatically installed in the Python script directory;



: http://www.scons.org/



3, other tutorials have written python27\scripts write path This step, Python 2.7.9 should be automatically written, can be omitted;



4, MongoDB C + + driver relies on the boost library (1.49 and above), you can directly download the compiled boost file directly installed, save the compilation, save half a day;



: http://sourceforge.net/projects/boost/files/boost-binaries/Select: boost_1_57_0-msvc-10.0-32



Note the 32-bit and 64-bit differences require compiling a 64-bit driver download for the 64-bit boost library.



5, download the MongoDB C + + driver source code, select;



: Https://github.com/mongodb/mongo-cxx-driver/wiki/Download%20and%20Compile



It is recommended to download 26compat stable branch, unzip to local.



6, the command line CD into the drive directory, using the following command to compile;


D:\mongo-cxx-driver-26compat>scons --dbg=on --32 --dynamic-windows --sharedclien
t --cpppath=D:\boost_1_57_0 --libpath=D:\boost_1_57_0\lib32-msvc-10.0 --use-syst
em-boost


This compiles the 32-bit dynamic library, which will produce Mongoclient.dll after the compilation is successful.



Cpppath Specify the boost header file directory;



Libpath Specify the Boost library directory;



Other commands can refer to the official website: https://github.com/mongodb/mongo-cxx-driver/wiki/Download%20and%20Compile



Problems with compiling MongoDB C + + drivers:



1, the official website recommended compile using the Install option, according to the meaning is compiled after the driver and the header files installed to the specified directory, but the use will be reported that the boost library can not find errors;






2, the use of a compiled driver prompts error_codes.h and error_codes.cpp files can not be found, these two files in the MongoDB C + + driver source, copy the past.



The above is a fast way to compile the MongoDB C + + driver, you can refer to at compile time.



Today I heard that MongoDB 3.0 is about to launch, write speed on the original basis of 6-7 times, performance is very strong ~






Record, for the better of myself!



Compiling MongoDB C + + driver details using VS2010


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.