Compiling MongoDB client library with Ubuntu

Source: Internet
Author: User
Tags mongodb client

A boost library is required.

1. Download cxx-driver for 2.0, unzip to/usr/src folder

wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz

2. sudo apt-Get install libpcre3-dev

3. sudo apt-Get install scons

Chenshu @ chenshu-Ubuntu:/usr/local/src/mongo-cxx-driver-v2.0 $

rm -f .sconsign.dblitescons --prefix=/usr install

Configure the sconstruct file if necessary. For example, if the boost library is located under/usr/lib, change the configuration from/usr/local to/usr.

4. If it is not installed in the/usr/lib directory, run the following command to copy it.

Sudo CP lib1_client. */usr/lib/

5. If you want to debug the source code during development, you need to find if Linux in the sconstruct file and add a line of-G parameters.

If Linux:
Env. append (linkflags = "-wl, -- as-needed-wl,-zdefs ")

Env. append (cppflags = "-G ")

After mongodb2.1, a bug occurs that the. So file cannot be compiled, but only the. A file can be compiled. Here is issue:

Https://jira.mongodb.org/browse/SERVER-6514? Page = com. Atlassian. Streams. streams-Jira-plugin: Activity-stream-issue-Tab

In the four-month period, this issue has no one to ask. It seems that MongoDB's core team is not as outstanding as the outside world imagined.

There are two bypass methods:

1. uncomment the 101 line of the src/sconscript. Client File and re-compile it.

2. Do not use the. So file and directly introduce the header file to your project.

# Include "src/Mongo/client/dbclient. H"

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.