Scroll to navigation

INSTALLING_THE_MONGODB_C_DRIVER(3) Library Functions Manual INSTALLING_THE_MONGODB_C_DRIVER(3)

NAME

Installing_the_MongoDB_C_Driver - None

SUPPORTED PLATFORMS

The MongoDB C Driver is continuously tested on variety of platforms including:

GNU/Linux
Solaris
Mac OS X
Microsoft Windows
x86 and x86_64
ARM
PPC
SPARC
aarch64
s390x
ppc64le
GCC 4.1 and newer
Clang 3.3 and newer
Microsoft Visual Studio 2010 and newer
Oracle Solaris Studio 12
MinGW

The driver is also known to work on FreeBSD, and should work on any POSIX compatible platform with a working c89 (or later) compiler.

INSTALL WITH A PACKAGE MANAGER

The libmongoc package is available on recent versions of Debian and Ubuntu.

$ apt-get install libmongoc-1.0-0

For RedHat‐like systems, use Remi Collet's well‐maintained RPMs. Commands to enable Remi's repository and install libmongoc depend on your exact system. For example, on CentOS 6:

$ yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm $ yum install yum-utils $ yum-config-manager --enable remi $ yum update $ yum install mongo-c-driver

The Configuration Wizard for Remi's RPM Repository generates detailed instructions for your system.

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.4.2 and can be downloaded here

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:

NATIVE TLS SUPPORT ON MAC OS X / DARWIN (SECURE TRANSPORT)

The MongoDB C Driver supports the Darwin native TLS and crypto libraries. Using the native libraries there is no need to install OpenSSL. By default however, the driver will compile against OpenSSL if it detects it being available. If OpenSSL is not available, it will fallback on the native libraries.

To compile against the Darwin native TLS and crypto libraries, even when OpenSSL is available, configure the driver like so:

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 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 2015 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:ngo-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:ngo-c-driver

NATIVE TLS SUPPORT ON WINDOWS (SECURE CHANNEL)

The MongoDB C Driver supports the Windows native TLS and crypto libraries. Using the native libraries there is no need to install OpenSSL. By default however, the driver will compile against OpenSSL if it detects it being available. If OpenSSL is not available, it will fallback on the native libraries.

To compile against the Windows native TLS and crypto libraries, even when OpenSSL is available, configure the driver like so:

COLOPHON

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