Build MongoDB C++ Driver from Source

Medical Technology, Healthcare & Government IT

.
Categories
Category Groups

MongoDB C++ Driver

Prerequisite

  • [Build Boost Library](../Developer Operations\(DevOps\)/Build Boost Library.md)
  • [Setting up MongoDB](../System Operations\(SysOps\)/Build MongoDB from Source.md)

Scons

Scons required to build MongoDB C++ driver. Required version of scons is 2.1.0-1

For CentOS, download from the following link and copy it to ~/Downloads. Install using the following command.

sudo rpm -ivh ~/Downloads/scons-2.1.0-1.noarch.rpm

For Ubuntu

apt-get install scons

PCRE

For CentOS,

sudo yum install pcre-devel

Download and Install

Download the MongoDB C++ driver(mongodb-linux-x86_64-v1.8)from the link.Click here to download and copy it to ~/Downloads.

Extract mongodb-linux-x86_64-v1.8-latest.tgz file using the command

cd ~/Downloads
tar -xvf mongodb-linux-x86_64-v1.8-latest.tgz

To compile the “standalone” C++ driver, run the scons command in the installation directory of the driver

cd mongo-cxx-driver-v1.8
scons
sudo scons --prefix=/opt/mongodb-cxx-driver install
sudo chown -R `id -u` /opt/mongodb-cxx-driver

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/mongodb-cxx-driver/lib

Original Link

One Comment

  1. FrAnKeStEiN MC

    Hi,
    when running scons i get the following

    scons: Reading SConscript files …

    scons version: 2.3.6

    python version: 2 7 3 ‘final’ 0

    Checking whether the C++ compiler works… yes

    Checking whether the C compiler works… yes

    Checking if C++ compiler “g++” is GCC… yes

    Checking if C compiler “gcc” is GCC… yes

    Checking if C compiler supports -Wno-unused-local-typedefs… no

    Checking if C compiler supports -Wno-unused-function… yes

    Checking if C compiler supports -Wno-unused-private-field… no

    Checking if C compiler supports -Wno-deprecated-declarations… yes

    Checking if C compiler supports -Wno-tautological-constant-out-of-range-compare… no

    Checking if C compiler supports -Wno-unused-const-variable… no

    Checking if C compiler supports -Wno-missing-braces… yes

    Checking if we are using libstdc++… yes

    Checking for libstdc++ 4.6.0 or better… yes

    Checking if we are on a POSIX system… yes

    Checking if the POSIX monotonic clock is supported… yes

    Checking for __thread… yes

    Checking for gcc __atomic builtins… no

    Checking for useable __sync builtins… yes

    Checking for C++ header file boost/version.hpp… yes

    Checking for C++ library boost_regex-mt… no

    Checking for C++ library boost_regex… no

    can’t find boost

    can you help me ?

Leave a Reply