Scroll to navigation

INSTALLING_LIBBSON(3) Library Functions Manual INSTALLING_LIBBSON(3)

NAME

Installing_Libbson - None

SUPPORTED PLATFORMS

Libbson is continuously tested on GNU/Linux, Windows 7, Mac OS X 10.10, and Solaris 11 (Intel and Sparc), with GCC, Clang, and Visual Studio 2010, 2013, and 2015.

The library supports the following operating systems and CPU architectures:

GNU/Linux
Solaris 11
Mac OS X 10.6 and newer
Windows Vista, 7, and 8
FreeBSD
x86 and x86_64
ARM
PPC
SPARC
GCC 4.1 and newer
Clang 3.3 and newer
Microsoft Visual Studio 2010 and newer
Oracle Solaris Studio 12
MinGW

INSTALL WITH A PACKAGE MANAGER

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

$ apt-get install libbson-1.0

For RedHat‐like systems, use Remi Collet's well‐maintained RPMs for libbson. Commands to enable Remi's repository and install libbson 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 libbson

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

INSTALLING FROM SOURCE

The following instructions are for UNIX‐like systems such as GNU/Linux, FreeBSD, and Solaris. To build on Windows, see the instructions for Building on Windows

The most recent release of libbson is 1.4.2 and can be downloaded here

$ wget https://github.com/mongodb/libbson/releases/download/1.4.2/libbson-1.4.2.tar.gz $ tar -xzf libbson-1.4.2.tar.gz $ cd libbson-1.4.2/

Minimal dependencies are needed to build Libbson. On UNIX‐like systems, pthreads (the POSIX threading library) is required.

Make sure you have access to a supported toolchain such as GCC, Clang, SolarisStudio, or MinGW. Optionally, pkg-config can be used if your system supports it to simplify locating proper compiler and linker arguments when compiling your program.

The following will configure for a typical 64‐bit Linux system such as RedHat Enterprise Linux 6 or CentOS 6. Note that not all systems place 64‐bit libraries in /usr/lib64

$ ./configure --prefix=/usr --libdir=/usr/lib64

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

libbson was configured with the following options:
Build configuration:
  Enable debugging (slow)                          : no
  Enable extra alignment (required for 1.0 ABI)    : no
  Compile with debug symbols (slow)                : no
  Enable GCC build optimization                    : yes
  Enable automatic binary hardening                : yes
  Code coverage support                            : no
  Cross Compiling                                  : no
  Big endian                                       : no
  Link Time Optimization (experimental)            : no
Documentation:
  man                                              : yes
  HTML                                             : no

We can now build libbson with the venerable make program.

$ make

NOTE

You can optionally build code objects in parallel using the -j option to GNU make. Some implementations of make do not support this option, such as Sun's make on Solaris 10. To build in parallel on an 8 core machine, you might use:

$ gmake -j8

To install the driver, we use make with the install target.

$ sudo make install

NOTE

On systems that do not support the sudo command, we can use su -c 'make install'

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. The following assumes we are compiling for 64‐bit Windows using Visual Studio 2010 Express which can be freely downloaded from Microsoft.

> cd libbson-1.4.2 > cmake -G Visual Studio 14 2015 Win64 -DCMAKE_INSTALL_PREFIX=C: > msbuild.exe ALL_BUILD.vcxproj > msbuild.exe INSTALL.vcxproj

You should now see libbson installed in C: You can disable building the tests with: > cmake -G Visual Studio 14 2015 Win64 -DCMAKE_INSTALL_PREFIX=C:

COLOPHON

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