Building

The DataStax C/C++ Driver for Apache Cassandra and DataStax Products will build on most standard Unix-like and Microsoft Windows platforms. Packages are available for the following platforms:

  • CentOS 7
  • Rocky Linux 8.8
  • Rocky Linux 9.2
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows

NOTE: The build procedures only need to be performed for driver development or if your system doesn’t have packages available for download and installation.

Compatibility

  • Architectures: 32-bit (x86) and 64-bit (x64)
  • Compilers: GCC 4.8.5+ Clang 3.4+, and MSVC 2013/2015/2017/2019

Dependencies

The C/C++ driver depends on the following software:

* Use the CASS_USE_KERBEROS CMake option to enable/disable Kerberos support. Enabling this option will enable Kerberos authentication protocol within the driver; defaults to Off.

** Use the CASS_USE_OPENSSL CMake option to enable/disable OpenSSL support. Disabling this option will disable SSL/TLS protocol support within the driver; defaults to On.

*** Use the CASS_USE_ZLIB CMake option to enable/disable zlib support. Disabling this option will disable DataStax Astra support within the driver; defaults to On.

A Brief Note on OpenSSL 3.x

Migrating from OpenSSL 1.1.x to 3.x largely involves avoiding the use of many functions which are now deprecated (consult the migration guide for details). The driver does not use any of these functions so we expect the transition to OpenSSL 3.x to be relatively painless. Note that two officially supported platforms (Ubuntu 22.04 and Rocky Linux 9.2) come with OpenSSL 3.x by default and the unit and integration tests all pass on these platforms.

Linux/Mac OS

The driver is known to build on CentOS/RHEL 6/7/8, Mac OS X 10.10/10.11 (Yosemite and El Capitan), Mac OS 10.12/10.13 (Sierra and High Sierra), and Ubuntu 14.04/16.04/18.04 LTS.

NOTE: The driver will also build on most standard Unix-like systems using GCC 4.1.2+ or Clang 3.4+.

Installing dependencies

Initial environment setup

CentOS/RHEL (Yum)
Copy
yum install automake cmake gcc-c++ git libtool
Ubuntu (APT)
Copy
apt-get update
apt-get install build-essential cmake git
Mac OS (Brew)

Homebrew (or brew) is a free and open-source software package management system that simplifies the installation of software on the Mac OS operating system. Ensure Homebrew is installed before proceeding.

Copy
brew update
brew upgrade
brew install autoconf automake cmake libtool

Kerberos

CentOS/RHEL (Yum)
Copy
yum install krb5-devel
Ubuntu (APT)
Copy
apt-get install libkrb5-dev

libuv

libuv v1.x should be used in order to ensure all features of the C/C++ driver are available. When using a package manager for your operating system make sure you install v1.x; if available.

CentOS, Rocky and Ubuntu packages

Packages are available from our Artifactory server. Select the driver version, build and platform and then look for the dependencies directory. Note that the version of libuv available on Ubuntu can be used when building the driver. As a result we only provide packages for CentOS and Rocky.

Mac OS (Brew)
Copy
brew install libuv
Manually build and install

The following procedures should be performed if packages are not available for your system.

Copy
pushd /tmp
wget http://dist.libuv.org/dist/v1.34.0/libuv-v1.35.0.tar.gz
tar xzf libuv-v1.35.0.tar.gz
pushd libuv-v1.35.0
sh autogen.sh
./configure
make install
popd
popd

OpenSSL

CentOS (Yum)
Copy
yum install openssl-devel
Ubuntu (APT)
Copy
apt-get install libssl-dev
Mac OS (Brew)
Copy
brew install openssl

Note: For Mac OS X 10.11 (El Capitan) and Mac OS 10.12/10.13 (Sierra and High Sierra) a link needs to be created in order to make OpenSSL available to the building libraries:

Copy
brew link --force openssl
Manually build and install
Copy
pushd /tmp
wget --no-check-certificate https://www.openssl.org/source/openssl-1.0.2u.tar.gz
tar xzf openssl-1.0.2u.tar.gz
pushd openssl-1.0.2u
CFLAGS=-fpic ./config shared
make install
popd
popd

zlib

CentOS (Yum)
Copy
yum install zlib-devel
Ubuntu (APT)
Copy
apt-get install zlib1g-dev
Mac OS (Brew)
Copy
brew install zlib
Manually build and install
Copy
pushd /tmp
wget --no-check-certificate https://www.zlib.net/zlib-1.2.11.tar.gz
tar xzf zlib-1.2.11.tar.gz
pushd zlib-1.2.11
./configure
make install
popd
popd

Building and installing the C/C++ driver

Copy
mkdir build
pushd build
cmake ..
make
make install
popd

Building examples (optional)

Examples are not built by default and need to be enabled. Update your CMake line to build examples.

Copy
cmake -DCASS_BUILD_EXAMPLES=On ..

Building tests (optional)

Tests (integration and unit) are not built by default and need to be enabled.

All tests
Copy
cmake -DCASS_BUILD_TESTS=On ..

Note: This will build both the integration and unit tests

Integration tests
Copy
cmake -DCASS_BUILD_INTEGRATION_TESTS=On ..
Unit tests
Copy
cmake -DCASS_BUILD_UNIT_TESTS=On ..

Windows

The driver is known to build with Visual Studio 2013, 2015, 2017, and 2019.

Obtaining build dependencies

  • Download and install Bison
    • Make sure Bison is in your system PATH and not installed in a directory with spaces (e.g. %SYSTEMDRIVE%\GnuWin32)
  • Download and install CMake
    • Make sure to select the option “Add CMake to the system PATH for all users” or “Add CMake to the system PATH for current user”
  • Download and install Strawberry Perl or ActiveState Perl
    • Make sure to select the option “Add Perl to PATH environment variable”
  • Download and install Kerberos for Windows v4.0.1

Building the driver

First you will need to open a “Command Prompt” to execute the CMake commands.

Building the C/C++ driver

Supported generators are: * Visual Studio 12 2013 * Visual Studio 14 2015 * Visual Studio 15 2017 * Visual Studio 16 2019

Copy
mkdir build
pushd build
cmake -G "Visual Studio 16 2019" -A x64 ..
cmake --build .
popd

Note: To build 32-bit binaries/libraries use -A Win32.

Building examples (optional)

Examples are not built by default and need to be enabled. Update your CMake line to build examples.

Copy
cmake -G "Visual Studio 16 2019" -A x64 -DCASS_BUILD_EXAMPLES=On ..

Building tests (optional)

Tests (integration and unit) are not built by default and need to be enabled.

All tests
Copy
cmake -G "Visual Studio 16 2019" -A x64 -DCASS_BUILD_TESTS=On ..

Note: This will build both the integration and unit tests

Integration tests
Copy
cmake -G "Visual Studio 16 2019" -A x64 -DCASS_BUILD_INTEGRATION_TESTS=On ..
Unit tests
Copy
cmake -G "Visual Studio 16 2019" -A x64 -DCASS_BUILD_UNIT_TESTS=On ..