mongoc_installing man page

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

On Fedora, a mongo‐c‐driver package is available in the default repositories and can be installed with:

$ dnf install mongo-c-driver

On recent Red Hat systems, such as CentOS and RHEL 7, a mongo‐c‐driver package is available in the EPEL repository. To check version available, see https://apps.fedoraproject.org/packages…

$ yum install mongo-c-driver

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.5.0 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:

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: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

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.

Info

2016‐11‐28 MongoDB C Driver