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