Full Installation of the C++ SDK

      +
      Installation instructions for the Couchbase C++ Client.

      This page gives full installation instructions for the C++ SDK. In most cases, the Quickstart Guide should be enough to get you up and running if you’re in a hurry.

      Prerequisites

      A C++ 17 compiler and CMake version 3.19 or newer is required. See the Compatibility section for details on supported platforms.

      Installing the SDK

      With CPM.cmake

      CPM.cmake makes it really easy to include the library in your project. You only need to include the following command in your CMakeLists.txt.

      CPMAddPackage(
        NAME
        couchbase_cxx_client
        GIT_TAG
        1.0.4
        VERSION
        1.0.4
        GITHUB_REPOSITORY
        "couchbase/couchbase-cxx-client"
        OPTIONS
        "COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL ON")

      Building from source

      Full instructions to build the SDK from source are given in the README of our GitHub repository.

      Install on MacOS X

      Install Homebrew using instructions from https://docs.brew.sh/Installation.

      Configure tap for Couchbase:

      $ brew tap couchbaselabs/homebrew-couchbase

      Install the library:

      $ brew install couchbase-cxx-client

      Install on RPM-based Systems

      First, check how the platform identifies itself

      $ rpm -E '%dist/%_arch' | sed 's/^\.//'

      This command would print the distribution/architecture part of the .repo URL. For example, for AmazonLinux 2023 on ARM architecture it prints the following:

      $ rpm -E '%dist/%_arch' | sed 's/^\.//'
      amzn2023/aarch64

      Now use this string to download repository URL:

      DIST_ARCH=$(rpm -E '%dist/%_arch' | sed 's/^\.//')
      REPO_URL="https://packages.couchbase.com/clients/cxx/repos/rpm/${DIST_ARCH}/couchbase-cxx-client.repo"
      curl -L -o/etc/yum.repos.d/couchbase-cxx-client.repo $REPO_URL

      To list all the packages provided by the repository run this command:

      $ dnf list --available --disablerepo=* --enablerepo=couchbase
      Available Packages
      couchbase-cxx-client.aarch64                     1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client.src                         1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client-debuginfo.aarch64           1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client-debugsource.aarch64         1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client-devel.aarch64               1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client-tools.aarch64               1.0.3-1.amzn2023      couchbase
      couchbase-cxx-client-tools-debuginfo.aarch64     1.0.3-1.amzn2023      couchbase

      To install the library with the headers:

      dnf install couchbase-cxx-client couchbase-cxx-client-devel

      To install the command line tools:

      dnf install couchbase-cxx-client-tools

      Currently supported platforms are aarch64 and x86_64 for the following distributions:

      Install on DEB-based Systems

      First, check how the platform identifies itself:

      $ (source /etc/os-release; echo ${VERSION_CODENAME}/$(uname -m))

      This command prints the distribution/architecture part of the .source URL. For example, for Ubuntu 20.04 on x86_64 architecture it prints the following:

      $ (source /etc/os-release; echo ${VERSION_CODENAME}/$(uname -m))
      jammy/x86_64

      Ensure that GnuPG and curl are installed:

      $ apt update && apt install curl gpg

      Now use this string to download the repository URL:

      $ DIST_ARCH=$(source /etc/os-release; echo ${VERSION_CODENAME}/$(uname -m))
      $ curl -L https://packages.couchbase.com/clients/cxx/repos/deb/${DIST_ARCH}/DEB-GPG-KEY.txt | \
        gpg --yes --dearmor -o /usr/share/keyrings/couchbase-archive-keyring.gpg
      $ curl -L -o/etc/apt/sources.list.d/couchbase-cxx-client.sources \
        https://packages.couchbase.com/clients/cxx/repos/deb/${DIST_ARCH}/couchbase-cxx-client.sources
      Update the apt Sources
      $ apt update
      Install the library with the headers:
      $ apt install couchbase-cxx-client couchbase-cxx-client-dev
      Install the command line tools:
      apt install couchbase-cxx-client-tools

      Currently supported platforms are aarch64 and x86_64 for the following distributions: