Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use find_package for nlohmann_json #2880

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ cc_binary(
| 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 |
| nljson | 3.6.1 | JSON for Modern C++ |

Note that these libraries may also depend on other libraries. The following
instructions include steps to install these indirect dependencies too.
Expand Down Expand Up @@ -165,7 +166,7 @@ tools to compile the dependencies:

```bash
sudo dnf makecache && \
sudo dnf install -y grpc-devel grpc-plugins \
sudo dnf install -y grpc-devel grpc-plugins json-devel \
libcurl-devel protobuf-compiler tar wget zlib-devel
```

Expand Down Expand Up @@ -221,7 +222,8 @@ Platform proto files.

```bash
sudo zypper refresh && \
sudo zypper install -y grpc-devel gzip libcurl-devel pkg-config tar wget
sudo zypper install -y grpc-devel gzip libcurl-devel nlohmann_json \
pkg-config tar wget
```

#### crc32c
Expand Down Expand Up @@ -267,7 +269,8 @@ Install the minimal development tools:
```bash
sudo zypper refresh && \
sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
libcurl-devel libopenssl-devel make tar wget
libcurl-devel libopenssl-devel make nlohmann_json \
tar wget
```

#### crc32c
Expand Down Expand Up @@ -383,7 +386,7 @@ Install the minimal development tools:
sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \
pkg-config tar wget zlib1g-dev
nlohmann-json-dev pkg-config tar wget zlib1g-dev
```

#### crc32c
Expand Down Expand Up @@ -547,6 +550,21 @@ sudo make install
sudo ldconfig
```

#### nlohmann_json

Ubuntu-16.04 does not provide a package for nlohmann_json. Manually install
this library:

```bash
cd $HOME/Downloads
wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
tar -xf json-3.6.1.tar.gz
cd $HOME/Downloads/json-3.6.1
cmake H. -Bcmake-out
cmake --build cmake-out -- -j $(nproc)
sudo cmake --build cmake-out --target install
```

#### google-cloud-cpp

Finally we can install `google-cloud-cpp`.
Expand All @@ -566,7 +584,6 @@ sudo cmake --build . --target install
### Ubuntu (14.04 - Trusty Tahr)

Install the minimal development tools.

We use the `ubuntu-toolchain-r` PPA to get a modern version of CMake:

```bash
Expand Down Expand Up @@ -699,6 +716,21 @@ make -j $(nproc)
sudo make install
```

#### nlohmann_json

Ubuntu:trusty does not provide a package for nlohmann_json. Manually install
this library:

```bash
cd $HOME/Downloads
wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
tar -xf json-3.6.1.tar.gz
cd $HOME/Downloads/json-3.6.1
cmake H. -Bcmake-out
cmake --build cmake-out -- -j $(nproc)
sudo cmake --build cmake-out --target install
```

#### google-cloud-cpp

We can now compile and install `google-cloud-cpp`.
Expand Down Expand Up @@ -730,7 +762,7 @@ prevent you from compiling against openssl-1.1.0.

```bash
sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
sudo apt install -y build-essential cmake git gcc g++ json-devel cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev make \
pkg-config tar wget zlib1g-dev
```
Expand Down Expand Up @@ -820,7 +852,7 @@ sudo yum install -y centos-release-scl
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum makecache && \
sudo yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \
make openssl-devel pkgconfig tar wget which zlib-devel
make json-devel openssl-devel pkgconfig tar wget which zlib-devel
ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest
```

Expand Down
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ of these tools we test with are:

#### Libraries

The libraries also depend on gRPC, libcurl, and the dependencies of those
The libraries also depend on gRPC, libcurl, nlohmann-json and the dependencies of those
libraries. The Google Cloud C++ Client libraries are tested with the following
versions of these dependencies:

| Library | Minimum version |
| ------- | --------------- |
| gRPC | v1.16.x |
| libcurl | 7.47.0 |
| nljson | 3.6.1 |

#### Tests

Expand All @@ -156,7 +157,7 @@ sudo yum install -y centos-release-scl
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum makecache && \
sudo yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \
make openssl-devel pkgconfig tar wget which zlib-devel
make json-devel openssl-devel pkgconfig tar wget which zlib-devel
ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest
```

Expand All @@ -179,7 +180,7 @@ prevent you from compiling against openssl-1.1.0.
sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev make \
pkg-config tar wget zlib1g-dev
nlohmann-json3 pkg-config tar wget zlib1g-dev
```

### Fedora (30)
Expand All @@ -192,7 +193,7 @@ sudo apt install -y build-essential cmake git gcc g++ cmake \
```bash
sudo dnf makecache && \
sudo dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \
zlib-devel
json-devel zlib-devel
```

### OpenSUSE (Tumbleweed)
Expand All @@ -205,7 +206,8 @@ sudo dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \
```bash
sudo zypper refresh && \
sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
libcurl-devel libopenssl-devel make tar wget zlib-devel
libcurl-devel libopenssl-devel make nlohmann_json \
tar wget zlib-devel
```

### OpenSUSE (Leap)
Expand All @@ -218,7 +220,7 @@ sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
```bash
sudo zypper refresh && \
sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
libcurl-devel libopenssl-devel make tar wget
libcurl-devel libopenssl-devel make nlohmann_json tar wget
```

### Ubuntu (18.04 - Bionic Beaver)
Expand All @@ -232,7 +234,7 @@ sudo zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
sudo apt update && \
sudo apt install -y build-essential cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \
pkg-config tar wget zlib1g-dev
nlohmann-json-dev pkg-config tar wget zlib1g-dev
```

### Ubuntu (16.04 - Xenial Xerus)
Expand All @@ -249,6 +251,19 @@ sudo apt install -y build-essential cmake git gcc g++ cmake \
pkg-config tar wget zlib1g-dev
```

Ubuntu-16.04 does not provide a package for nlohmann_json. Manually install
this library:

```bash
cd $HOME/Downloads
wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
tar -xf json-3.6.1.tar.gz
cd $HOME/Downloads/json-3.6.1
cmake H. -Bcmake-out
cmake --build cmake-out -- -j $(nproc)
sudo cmake --build cmake-out --target install
```

### Ubuntu (14.04 - Trusty Tahr)

[![Kokoro install ubuntu-trusty status][kokoro-install-ubuntu-trusty-shield]][kokoro-install-ubuntu-trusty-link]
Expand Down Expand Up @@ -294,6 +309,19 @@ export OPENSSL_ROOT_DIR=/usr/local/ssl
export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig
```

Ubuntu:trusty does not provide a package for nlohmann_json. Manually install
this library:

```bash
cd $HOME/Downloads
wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
tar -xf json-3.6.1.tar.gz
cd $HOME/Downloads/json-3.6.1
cmake H. -Bcmake-out
cmake --build cmake-out -- -j $(nproc)
sudo cmake --build cmake-out --target install
```

#### macOS (using brew)

```bash
Expand Down
2 changes: 1 addition & 1 deletion ci/benchmarks/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM ubuntu:bionic AS google-cloud-cpp-dependencies
RUN apt update && \
apt install -y build-essential cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \
pkg-config tar wget zlib1g-dev
nlohmann-json-dev pkg-config tar wget zlib1g-dev

# #### crc32c

Expand Down
1 change: 1 addition & 0 deletions ci/kokoro/docker/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN yum makecache && yum install -y \
gcc \
gcc-c++ \
git \
json-devel \
make \
openssl-devel \
python \
Expand Down
1 change: 1 addition & 0 deletions ci/kokoro/docker/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RUN dnf makecache && dnf install -y \
doxygen \
gcc-c++ \
git \
json-devel \
libcurl-devel \
libcxx-devel \
libcxxabi-devel \
Expand Down
1 change: 1 addition & 0 deletions ci/kokoro/docker/Dockerfile.fedora-install
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN dnf makecache && dnf install -y \
git \
grpc-devel \
grpc-plugins \
json-devel \
libcurl-devel \
libcxx-devel \
libcxxabi-devel \
Expand Down
1 change: 1 addition & 0 deletions ci/kokoro/docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt update && \
libtool \
lsb-release \
make \
nlohmann-json-dev \
pkg-config \
python-pip \
shellcheck \
Expand Down
1 change: 1 addition & 0 deletions ci/kokoro/docker/Dockerfile.ubuntu-install
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ RUN apt update && \
libtool \
lsb-release \
make \
nlohmann-json-dev \
pkg-config \
python-pip \
shellcheck \
Expand Down
10 changes: 10 additions & 0 deletions ci/kokoro/docker/Dockerfile.ubuntu-trusty
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ RUN apt update && apt install -y python-dev python-pip
RUN pip install --upgrade pip
RUN pip install flask httpbin gevent gunicorn crc32c

# Ubuntu:trusty does not provide a package for nlohmann_json. Manually install
# this library:
WORKDIR /var/tmp/build
RUN wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
RUN tar -xf json-3.6.1.tar.gz
WORKDIR /var/tmp/build/json-3.6.1
RUN cmake H. -Bcmake-out
RUN cmake --build cmake-out -- -j $(nproc)
RUN cmake --build cmake-out --target install

# Install the Cloud Bigtable emulator and the Cloud Bigtable command-line
# client. They are used in the integration tests.
COPY . /var/tmp/ci
Expand Down
2 changes: 1 addition & 1 deletion ci/kokoro/install/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN yum install -y centos-release-scl
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum makecache && \
yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \
make openssl-devel pkgconfig tar wget which zlib-devel
make json-devel openssl-devel pkgconfig tar wget which zlib-devel
RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest
# ```

Expand Down
2 changes: 1 addition & 1 deletion ci/kokoro/install/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FROM debian:${DISTRO_VERSION} AS devtools

# ```bash
RUN apt update && \
apt install -y build-essential cmake git gcc g++ cmake \
apt install -y build-essential cmake git gcc g++ json-devel cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev make \
pkg-config tar wget zlib1g-dev
# ```
Expand Down
2 changes: 1 addition & 1 deletion ci/kokoro/install/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN dnf makecache && \

# ```bash
RUN dnf makecache && \
dnf install -y grpc-devel grpc-plugins \
dnf install -y grpc-devel grpc-plugins json-devel \
libcurl-devel protobuf-compiler tar wget zlib-devel
# ```

Expand Down
3 changes: 2 additions & 1 deletion ci/kokoro/install/Dockerfile.opensuse
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RUN zypper refresh && \

# ```bash
RUN zypper refresh && \
zypper install -y grpc-devel gzip libcurl-devel pkg-config tar wget
zypper install -y grpc-devel gzip libcurl-devel nlohmann_json \
pkg-config tar wget
# ```

# #### crc32c
Expand Down
3 changes: 2 additions & 1 deletion ci/kokoro/install/Dockerfile.opensuse-leap
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ FROM opensuse/leap:${DISTRO_VERSION} AS devtools
# ```bash
RUN zypper refresh && \
zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \
libcurl-devel libopenssl-devel make tar wget
libcurl-devel libopenssl-devel make nlohmann_json \
tar wget
# ```

# #### crc32c
Expand Down
2 changes: 1 addition & 1 deletion ci/kokoro/install/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM ubuntu:${DISTRO_VERSION} AS devtools
RUN apt update && \
apt install -y build-essential cmake git gcc g++ cmake \
libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev make \
pkg-config tar wget zlib1g-dev
nlohmann-json-dev pkg-config tar wget zlib1g-dev
# ```

# #### crc32c
Expand Down
15 changes: 15 additions & 0 deletions ci/kokoro/install/Dockerfile.ubuntu-trusty
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ RUN make -j $(nproc)
RUN make install
# ```

# #### nlohmann_json

# Ubuntu:trusty does not provide a package for nlohmann_json. Manually install
# this library:

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
RUN tar -xf json-3.6.1.tar.gz
WORKDIR /var/tmp/build/json-3.6.1
RUN cmake H. -Bcmake-out
RUN cmake --build cmake-out -- -j $(nproc)
RUN cmake --build cmake-out --target install
# ```

FROM devtools AS install

# #### google-cloud-cpp
Expand Down
15 changes: 15 additions & 0 deletions ci/kokoro/install/Dockerfile.ubuntu-xenial
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ RUN make install
RUN ldconfig
# ```

# #### nlohmann_json

# Ubuntu-16.04 does not provide a package for nlohmann_json. Manually install
# this library:

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/nlohmann/json/archive/v3.6.1.tar.gz
RUN tar -xf json-3.6.1.tar.gz
WORKDIR /var/tmp/build/json-3.6.1
RUN cmake H. -Bcmake-out
RUN cmake --build cmake-out -- -j $(nproc)
RUN cmake --build cmake-out --target install
# ```

FROM devtools AS install

# #### google-cloud-cpp
Expand Down
Loading