Building CXX MongoDB Driver - linux-on-ibm-z/docs GitHub Wiki
Building CXX MongoDB Driver
Below versions of CXX MongoDB Driver are available in respective distributions at the time of creation of these build instructions:
- Ubuntu (22.04, 24.04) have
1.1.3
The instructions provided below specify the steps to build CXX MongoDB Driver version 4.4.0 on Linux on IBM Z for following distributions:
- RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
- SLES (15 SP7, 16)
- Ubuntu (22.04, 24.04)
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory
/<source_root>/will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
1. Build and Install CXX MongoDB Driver
1.1. Install dependencies
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
sudo yum install -y cyrus-sasl-devel gcc-c++ make openssl-devel pkgconfig snappy-devel git tar wget curl diffutils cmake python3 libarchive libzstd-devel -
SLES 15 SP7
sudo zypper install -y cmake cyrus-sasl-devel gcc14 gcc14-c++ make libopenssl-devel pkg-config snappy-devel git tar wget curl gzip libzstd-devel sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 14 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 14 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 14 sudo update-alternatives --install /usr/bin/s390x-linux-gnu-gcc s390x-linux-gnu-gcc /usr/bin/gcc-14 14 sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-14 14 -
SLES 16
sudo zypper install -y cmake cyrus-sasl-devel gcc-c++ make libopenssl-devel pkg-config snappy-devel git tar wget curl gzip libzstd-devel -
Ubuntu (22.04, 24.04)
sudo apt-get update sudo apt-get install -y cmake gcc g++ libsasl2-dev libssl-dev libsnappy-dev make pkg-config git tar wget curl python3 libzstd-dev
1.2. Build and Install MongoDB C Driver
cd $SOURCE_ROOT
git clone -b 2.3.1 https://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
mkdir cmake-build
cd cmake-build
cmake ..
make
sudo make install
1.3. Build and Install MongoDB CXX Driver
cd $SOURCE_ROOT
git clone -b r4.4.0 https://github.com/mongodb/mongo-cxx-driver.git
cd mongo-cxx-driver
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo cmake --build .
make
sudo make install
2. Basic validation test (Optional)
Please refer to Get started with the C++ Driver for basic validation test.