INSTALLING_THE_MONGODB_C_DRIVER(3)

NAME
Installing_the_MongoDB_C_Driver - None

SUPPORTED PLATFORMS

The MongoDB C Driver is continuously tested on GNU/Linux, Windows 7, Mac OS X 10.10, and Solaris 11 (Intel and Sparc). GCC, Clang, and Visual Studio 2013 compilers are continuously tested.

The driver supports the following operating systems and CPU architectures:

\[bu]
GNU/Linux

\[bu]
    Solaris 11

\[bu]
    Mac OS X 10.6 and newer

\[bu]
    Windows Vista, 7, and 8

\[bu]
    FreeBSD

\[bu]
    x86 and x86_64

\[bu]
    ARM

\[bu]
    PPC

\[bu]
    SPARC

\[bu]
    GCC 4.1 and newer

\[bu]
    Clang 3.3 and newer

\[bu]
    Microsoft Visual Studio 2013 and newer

\[bu]
    Oracle Solaris Studio 12

\[bu]
    MinGW

BUILDING ON UNIX

PREREQUISITES

OpenSSL is required for authentication or for SSL connections to MongoDB. Kerberos or LDAP support requires Cyrus SASL.

To install all optional dependencies on RedHat / Fedora:

On Debian / Ubuntu:

On FreeBSD:

BUILDING FROM A RELEASE TARBALL

Unless you intend on contributing to the mongo-c-driver, you will want to build from a release tarball.

The most recent release of libmongoc is 1.3.1 and can be downloaded here \&. The following snippet will download and extract the driver, and configure it:

If configure completed successfully, you'll see something like the following describing your build configuration.

mongo-c-driver contains a copy of libbson, in case your system does not already have libbson installed. The configure script will detect if libbson is not installed and use the bundled libbson.

BUILDING FROM GIT

To build an unreleased version of the driver from git requires additional dependencies.

RedHat / Fedora:

Debian / Ubuntu:

FreeBSD:

Once you have the dependencies installed, clone the repository and build the current master or a particular release tag:

GENERATING THE DOCUMENTATION

Install the yelp-tools and yelp-xsl packages, then:

BUILDING ON MAC OS X

PREREQUISITES

XCODE COMMAND LINE TOOLS

To install the XCode Command Line Tools, just type xcode-select --install in the Terminal and follow the instructions.

OPENSSL SUPPORT ON EL CAPITAN

Beginning in OS X 10.11 El Capitan, OS X no longer includes the OpenSSL headers. To build the driver with SSL on El Capitan and later, first install Homebrew according to its instructions , then:

BUILDING ON OS X

Download the latest release tarball:

Build and install the driver:

GENERATING THE DOCUMENTATION ON OS X

Homebrew is required to generate the driver's HTML documentation and man pages:

INSTALLING ON MAC OS X

To build the C Driver on a Mac, install the prerequisites in order to build it from source. It is recommended to use Homebrew :

$ brew install git automake autoconf libtool pkgconfig

Additionally, XCode is required. The driver can then be installed by following the directions for building from source \&.

BUILDING ON WINDOWS

Building on Windows requires Windows Vista or newer and Visual Studio 2010 or newer. Additionally, cmake is required to generate Visual Studio project files.

Let's start by generating Visual Studio project files for libbson, a dependency of the C driver. The following assumes we are compiling for 64-bit Windows using Visual Studio 2010 Express which can be freely downloaded from Microsoft.

(Run cmake -LH . for a list of other options.)

Now that we have project files generated, we can either open the project in Visual Studio or compile from the command line. Let's build using the command line program msbuild.exe

Now that libbson is compiled, let's install it using msbuild. It will be installed to the path specified by CMAKE_INSTALL_PREFIX \&.

You should now see libbson installed in C:\mongo-c-driver \&. Now let's do the same for the MongoDB C driver.

All of the MongoDB C Driver's components will now be found in C:\mongo-c-driver \&.

COLOPHON
This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.