| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
This document is intended for package maintainers or for people who might like to "install" the google-cloud-cpp libraries in /usr/local or a similar directory.
There are two primary ways of obtaining google-cloud-cpp. You can use git:
git clone https://github.com/googleapis/google-cloud-cpp.git $HOME/google-cloud-cppOr obtain the tarball release (see https://github.com/googleapis/google-cloud-cpp/releases for the latest release):
VERSION="vX.Y.Z"
mkdir -p $HOME/google-cloud-cpp
wget -q https://github.com/googleapis/google-cloud-cpp/archive/${VERSION}.tar.gz
tar -xf ${VERSION}.tar.gz -C $HOME/google-cloud-cpp --strip=1This document provides instructions to install the dependencies of google-cloud-cpp.
If all the dependencies of google-cloud-cpp are installed and provide CMake support files, then compiling and installing the libraries requires two commands:
cmake -H. -Bcmake-out -DBUILD_TESTING=OFF -DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out --target installUnfortunately getting your system to this state may require multiple steps, the following sections describe how to install google-cloud-cpp on several platforms.
As is often the case, the CMake build can be configured using a number of options and command-line flags. A full treatment of these options is outside the scope of this document, but here are a few highlights:
To find out about other configuration options, consider using ccmake, or cmake -L.
Once installed, follow any of the quickstart guides to use google-cloud-cpp in your CMake or Make-based project. If you are planning to use Bazel for your own project, there is no need to install google-cloud-cpp, we provide BUILD.bazel files for this purpose. The quickstart guides also cover this use-case.
google-cloud-cpp directly depends on the following libraries:
| Library | Minimum version | Description |
|---|---|---|
| Abseil | 20200923, Patch 3 | Abseil C++ common library (Requires >= 20210324.2 for pkg-config files to work correctly) |
| gRPC | 1.35.x | An RPC library and framework (not needed for Google Cloud Storage client) |
| libcurl | 7.47.0 | HTTP client library for the Google Cloud Storage client |
| crc32c | 1.0.6 | Hardware-accelerated CRC32C implementation |
| OpenSSL | 1.0.2 | Crypto functions for Google Cloud Storage authentication |
| nlohmann/json | 3.4.0 | JSON for Modern C++ |
| protobuf | v21.1 | C++ Micro-generator support |
Note that these libraries may also depend on other libraries. The following instructions include steps to install these indirect dependencies too.
When possible, the instructions below prefer to use pre-packaged versions of these libraries and their dependencies. In some cases the packages do not exist, or the packaged versions are too old to support google-cloud-cpp. If this is the case, the instructions describe how you can manually download and install these dependencies.
Alpine (Stable)Install the minimal development tools, libcurl, and OpenSSL:
apk update && \
apk add bash ca-certificates ccache cmake curl git \
gcc g++ make tar unzip zip zlib-devAlpine's version of pkg-config (https://github.com/pkgconf/pkgconf) is slow when handling .pc files with lots of Requires: deps, which happens with Abseil, so we use the normal pkg-config binary, which seems to not suffer from this bottleneck. For more details see pkgconf/pkgconf#229 and googleapis#7052.
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfigThe versions of Abseil, Protobuf, gRPC, OpenSSL, and nlohmann-json included with Alpine >= 3.16 meet google-cloud-cpp's requirements. We can simply install the development packages
apk update && \
apk add abseil-cpp-dev c-ares-dev curl-dev grpc-dev \
protobuf-dev nlohmann-json openssl-dev re2-devThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4}We can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools:
sudo dnf makecache && \
sudo dnf install -y ccache cmake curl findutils gcc-c++ git make ninja-build \
openssl-devel patch unzip tar wget zip zlib-develFedora 36 includes packages for gRPC and Protobuf, but they are not recent enough to support the protos published by Google Cloud. The indirect dependencies of libcurl, Protobuf, and gRPC are recent enough for our needs.
sudo dnf makecache && \
sudo dnf install -y c-ares-devel re2-devel libcurl-develFedora's version of pkg-config (https://github.com/pkgconf/pkgconf) is slow when handling .pc files with lots of Requires: deps, which happens with Abseil. If you plan to use pkg-config with any of the installed artifacts, you may want to use a recent version of the standard pkg-config binary. If not, sudo dnf install pkgconfig should work.
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigThe following steps will install libraries and tools in /usr/local. By default, pkg-config does not search in these directories.
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfigWe need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++17. Nevertheless, gRPC compiles with C++11 and depends on some of the Abseil polyfills, such as absl::string_view. Therefore, we pin Abseil's ABI to always use the polyfills. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigUnless you are only using the Google Cloud Storage library the project needs Protobuf and gRPC. Unfortunately the version of Protobuf that ships with Fedora 34 is not recent enough to support the protos published by Google Cloud. We need to build from source:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigFinally, we build gRPC from source:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl and OpenSSL. The gRPC Makefile uses which to determine whether the compiler is available. Install this command for the extremely rare case where it may be missing from your workstation or build server.
sudo zypper refresh && \
sudo zypper install --allow-downgrade -y automake ccache cmake curl \
gcc gcc-c++ git gzip libcurl-devel libopenssl-devel \
libtool make patch re2-devel tar wget which zlib zlib-devel-staticThe following steps will install libraries and tools in /usr/local. openSUSE does not search for shared libraries in these directories by default, there are multiple ways to solve this problem, the following steps are one solution:
(echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
sudo tee /etc/ld.so.conf.d/usrlocal.conf
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
export PATH=/usr/local/bin:${PATH}We need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigRecent versions of gRPC require c-ares >= 1.11, while openSUSE/Leap distributes c-ares-1.9. Manually install a newer version:
mkdir -p $HOME/Downloads/c-ares && cd $HOME/Downloads/c-ares
curl -sSL https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz | \
tar -xzf - --strip-components=1 && \
./buildconf && ./configure && make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We manually install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, OpenSSL and libc-ares:
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ccache cmake ca-certificates curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libre2-dev \
libssl-dev m4 make pkg-config tar wget zlib1g-devWe need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++17. Nevertheless, gRPC compiles with C++11 and depends on some of the Abseil polyfills, such as absl::string_view. Therefore, we pin Abseil's ABI to always use the polyfills. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, OpenSSL and libc-ares:
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ccache cmake ca-certificates curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libre2-dev \
libssl-dev m4 make pkg-config tar wget zlib1g-devWe need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, OpenSSL and libc-ares:
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ccache cmake ca-certificates curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 \
make pkg-config tar wget zlib1g-devWe need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need a newer version of RE2 than the system package provides.
mkdir -p $HOME/Downloads/re2 && cd $HOME/Downloads/re2
curl -sSL https://github.com/google/re2/archive/2022-12-01.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DRE2_BUILD_TESTING=OFF \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-H. -Bcmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, and OpenSSL:
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ca-certificates ccache cmake curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libre2-dev \
libssl-dev m4 make ninja-build pkg-config tar wget zlib1g-devDebian 11 ships with Abseil==20200923.3. Unfortunately, the current gRPC version needs Abseil >= 20210324.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigDebian 11 also ships with nlohmann-json==3.9.1, which is recent enough for our needs:
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y nlohmann-json3-devUnless you are only using the Google Cloud Storage library the project needs Protobuf and gRPC. Unfortunately the version of Protobuf that ships with Debian 11 is not recent enough to support the protos published by Google Cloud. We need to build from source:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigFinally, we build gRPC from source:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, and OpenSSL:
sudo apt-get update && \
sudo apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ca-certificates ccache cmake curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libre2-dev \
libssl-dev m4 make ninja-build pkg-config tar wget zlib1g-devWe need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigUnless you are only using the Google Cloud Storage library the project needs Protobuf and gRPC. Unfortunately the version of Protobuf that ships with Debian 10 is not recent enough to support the protos published by Google Cloud. We need to build from source:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigFinally, we build gRPC from source:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, OpenSSL, and the c-ares library (required by gRPC):
sudo dnf makecache && \
sudo dnf update -y && \
sudo dnf install -y epel-release && \
sudo dnf makecache && \
sudo dnf install -y ccache cmake curl findutils gcc-c++ git make openssl-devel \
patch re2-devel zlib-devel libcurl-devel c-ares-devel tar wget whichRocky Linux's version of pkg-config (https://github.com/pkgconf/pkgconf) is slow when handling .pc files with lots of Requires: deps, which happens with Abseil. If you plan to use pkg-config with any of the installed artifacts, you may want to use a recent version of the standard pkg-config binary. If not, sudo dnf install pkgconfig should work.
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigThe following steps will install libraries and tools in /usr/local. By default, Rocky Linux 8 does not search for shared libraries in these directories, there are multiple ways to solve this problem, the following steps are one solution:
(echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
sudo tee /etc/ld.so.conf.d/usrlocal.conf
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
export PATH=/usr/local/bin:${PATH}We need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We manually install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installInstall the minimal development tools, libcurl, OpenSSL, and the c-ares library (required by gRPC):
sudo dnf makecache && \
sudo dnf update -y && \
sudo dnf install -y epel-release && \
sudo dnf makecache && \
sudo dnf install -y ccache cmake findutils gcc-c++ git make openssl-devel \
patch re2-devel zlib-devel libcurl-devel c-ares-devel tar wget whichRocky Linux's version of pkg-config (https://github.com/pkgconf/pkgconf) is slow when handling .pc files with lots of Requires: deps, which happens with Abseil. If you plan to use pkg-config with any of the installed artifacts, you may want to use a recent version of the standard pkg-config binary. If not, sudo dnf install pkgconfig should work.
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigThe following steps will install libraries and tools in /usr/local. By default, Rocky Linux 9 does not search for shared libraries in these directories, there are multiple ways to solve this problem, the following steps are one solution:
(echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
sudo tee /etc/ld.so.conf.d/usrlocal.conf
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
export PATH=/usr/local/bin:${PATH}Rocky Linux 9 includes a package for Abseil, unfortunately, this package is incomplete, as it lacks the CMake support files for it. We need to compile Abseiil from source.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In Rocky Linux 9 the compiler defaults to C++17. Therefore, we change absl/base/options.h to always use std::any, std::string_view, and std::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 1/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigRocky Linux ships with Protobuf 3.14.x. Some of the libraries in google-cloud-cpp require Protobuf >= 3.15.8. For simplicity, we will just install Protobuf (and any downstream packages) from source.
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. Note that gRPC overrides the default C++ standard version to C++14, we need to configure it to use the platform's default. We manually install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installFirst install the development tools and OpenSSL. The development tools distributed with CentOS 7 are too old to build the project. In these instructions, we use cmake3 and gcc-7 obtained from Software Collections.
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y centos-release-scl yum-utils
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum makecache && \
sudo yum install -y automake ccache cmake3 curl-devel devtoolset-7 gcc gcc-c++ \
git libtool make openssl-devel patch re2-devel tar wget which zlib-devel
sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake && sudo ln -sf /usr/bin/ctest3 /usr/bin/ctestStart a bash shell with its environment configured to use the tools installed by devtoolset-7. IMPORTANT: All the following commands should be run from this new shell.
scl enable devtoolset-7 bashCentOS-7 ships with pkg-config 0.27.1, which has a bug that can make invocations take extremely long to complete. If you plan to use pkg-config with any of the installed artifacts, you'll want to upgrade it to something newer. If not, sudo yum install pkgconfig should work instead.
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigThe following steps will install libraries and tools in /usr/local. By default, CentOS-7 does not search for shared libraries in these directories, there are multiple ways to solve this problem, the following steps are one solution:
(echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
sudo tee /etc/ld.so.conf.d/usrlocal.conf
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
export PATH=/usr/local/bin:${PATH}We need a recent version of Abseil.
⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. We recommend that you switch the default configuration to pin Abseil's ABI to the version used at compile time. In this case, the compiler defaults to C++14. Therefore, we change absl/base/options.h to always use absl::any, absl::string_view, and absl::variant. See abseil/abseil-cpp#696 for more information.
mkdir -p $HOME/Downloads/abseil-cpp && cd $HOME/Downloads/abseil-cpp
curl -sSL https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe need to install a version of Protobuf that is recent enough to support the Google Cloud Platform proto files:
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -sSL https://github.com/protocolbuffers/protobuf/archive/v21.12.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigRecent versions of gRPC require c-ares >= 1.11, while CentOS-7 distributes c-ares-1.10. Manually install a newer version:
mkdir -p $HOME/Downloads/c-ares && cd $HOME/Downloads/c-ares
curl -sSL https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz | \
tar -xzf - --strip-components=1 && \
./buildconf && ./configure && make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfigWe also need a version of gRPC that is recent enough to support the Google Cloud Platform proto files. We manually install it using:
mkdir -p $HOME/Downloads/grpc && cd $HOME/Downloads/grpc
curl -sSL https://github.com/grpc/grpc/archive/v1.51.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the Crc32c library, we need to compile this from source:
mkdir -p $HOME/Downloads/crc32c && cd $HOME/Downloads/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigThe project depends on the nlohmann_json library. We use CMake to install it as this installs the necessary CMake configuration files. Note that this is a header-only library, and often installed manually. This leaves your environment without support for CMake pkg-config.
mkdir -p $HOME/Downloads/json && cd $HOME/Downloads/json
curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-S . -B cmake-out && \
sudo cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
sudo ldconfigWe can now compile and install google-cloud-cpp:
# Pick a location to install the artifacts, e.g., `/usr/local` or `/opt`
PREFIX="${HOME}/google-cloud-cpp-installed"
cmake -H. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DBUILD_TESTING=OFF \
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
cmake --build cmake-out -- -j "$(nproc)"
cmake --build cmake-out --target installFirst install Xcode to get all the needed development tools. These instructions also use Homebrew to install the needed third-party dependencies.
If you don't already have Xcode installed:
xcode-select --installFollow the instructions at https://brew.sh to install Homebrew. Then install the needed dependencies:
# Some additional build tools
brew install cmake ninja
# Installs google-cloud-cpp's needed deps
brew install abseil protobuf grpc nlohmann-json crc32c openssl@1.1⚠️ By default, Abseil's ABI changes depending on whether it is used with C++ >= 17 enabled or not. Installing Abseil with the default configuration is error-prone, unless you can guarantee that all the code using Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same C++ version. Homebrew's version of Abseil is compiled with C++17 and requires that all dependencies are thus compiled. See abseil/abseil-cpp#696, and the homebrew formula for more information.
Now configure, build, and install the google-cloud-cpp libraries that you need. In this example, we install the storage and spanner libraries.
cmake -S . -B cmake-out \
-GNinja \
-DGOOGLE_CLOUD_CPP_ENABLE="storage;spanner" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=OFF \
-DOPENSSL_ROOT_DIR="$(brew --prefix openssl@1.1)" \
-DCMAKE_INSTALL_PREFIX=/tmp/test-install
cmake --build cmake-out
cmake --build cmake-out --target install| Back | FazBrowse Home | New Git URL |