Skip to content

Commit e7b3778

Browse files
authored
Improve README steps to build the system [skip ci]. (#914)
* Improve README steps to build the system [skip ci]. Reduce the number of dependencies to install, use Dockerfiles to test the steps. Add documentation for OpenSuSE, clarify that the steps for Ubuntu Bionic also work for Ubuntu Xenial. Sadly the steps for Ubuntu Trusty are quite convoluted, created #913 to improve that. Add the steps for Debian Stretch. * Address review comments [skip ci]. * Addressed review comments. [skip ci] * Address review comments and typos [skip ci].
1 parent c682952 commit e7b3778

8 files changed

Lines changed: 325 additions & 21 deletions

File tree

README.md

Lines changed: 77 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ APIs.
3636
- [Tests](#tests)
3737
- [Install Dependencies](#install-dependencies)
3838
- [CentOS](#centos)
39+
- [Debian (Stretch)](#debian-stretch)
3940
- [Fedora](#fedora)
41+
- [OpenSuSE (Tumbleweed)](#opensuse-tumbleweed)
42+
- [OpenSuSE (Leap)](#opensuse-leap)
4043
- [Ubuntu (Bionic Beaver)](#ubuntu-bionic-beaver)
41-
- [Ubuntu (Trusty)](#ubuntu-trusty)
44+
- [Ubuntu (Xenial Xerus)](#ubuntu-xenial-xerus)
45+
- [Ubuntu (Trusty)](#ubuntu-trusty-tahr)
4246
- [macOS (using brew)](#macos-using-brew)
43-
- [Windows](#windows)
47+
- [Windows](#windows-using-vcpkg)
4448
- [Build](#build)
4549
- [Linux and macOS](#linux-and-macos)
4650
- [Windows](#windows-1)
@@ -90,6 +94,10 @@ against the latest version of the SDK on each commit and PR.
9094

9195
#### CentOS
9296

97+
The default compiler on CentOS doesn't fully support C++11. We need to upgrade
98+
the compiler and other development tools. In these instructions, we use `g++-7`
99+
via [Software Collections](https://www.softwarecollections.org/).
100+
93101
```bash
94102
# Extra Packages for Enterprise Linux used to install cmake3
95103
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@@ -98,49 +106,97 @@ yum install centos-release-scl
98106
yum-config-manager --enable rhel-server-rhscl-7-rpms
99107

100108
yum makecache
101-
yum install -y devtoolset-7 c-ares-devel ccache cmake3 curl curl-devel git golang graphviz openssl-devel pkgconfig python python-pip python-gunicorn shtool unzip wget which zlib-devel
102-
103-
pip install httpbin
109+
yum install -y devtoolset-7 cmake3 curl-devel git openssl-devel
104110

105111
# Install cmake3 & ctest3 as cmake & ctest respectively.
106112
ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest
107113
```
108114

115+
#### Debian (Stretch)
116+
117+
```bash
118+
sudo apt update
119+
sudo apt install -y build-essential cmake git gcc g++ cmake libcurl4-openssl-dev libssl-dev make zlib1g-dev
120+
```
121+
109122
#### Fedora
110123

111124
```bash
112125
sudo dnf makecache
113-
sudo dnf install autoconf automake c-ares-devel ccache clang clang-tools-extra cmake curl dia doxygen gcc-c++ git golang graphviz lcov libcurl-devel libtool make ncurses-term openssl-devel pkgconfig python python-gunicorn python-httpbin shtool unzip wget which zlib-devel
126+
sudo dnf install -y clang cmake gcc-c++ git libcurl-devel make openssl-devel
127+
```
128+
129+
#### OpenSuSE (Tumbleweed)
130+
131+
```bash
132+
sudo zypper refresh
133+
sudo zypper install -y cmake gcc gcc-c++ git libcurl-devel make
134+
```
135+
136+
#### OpenSuSE (Leap)
137+
138+
The stock compiler on OpenSuSE (Leap) has poor support for C++11, we recommend
139+
updating to `g++-5` using:
140+
141+
```bash
142+
sudo zypper refresh
143+
sudo zypper install -y cmake gcc gcc-c++ git libcurl-devel make
144+
sudo zypper install gcc5 gcc5-c++
145+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 100
146+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 100
114147
```
115148

116149
#### Ubuntu (Bionic Beaver)
117150

118151
```bash
119152
sudo apt update
120-
sudo apt install abi-compliance-checker abi-dumper automake build-essential ccache clang clang-format cmake curl doxygen gawk git gcc g++ golang cmake libcurl4-openssl-dev libssl-dev libtool lsb-release make python-gunicorn python-httpbin tar wget zlib1g-dev
153+
sudo apt install -y build-essential cmake git gcc g++ cmake libcurl4-openssl-dev libssl-dev make zlib1g-dev
154+
```
155+
156+
#### Ubuntu (Xenial Xerus)
121157

122-
# By default, Ubuntu 18.04 does not install the alternatives for clang-format
123-
# so we need to manually install those.
158+
```bash
124159
sudo apt update
125-
sudo apt install -y clang-tidy clang-format clang-tools
126-
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-6.0 100
127-
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-6.0 100
128-
sudo update-alternatives --install /usr/bin/scan-build scan-build /usr/bin/scan-build-6.0 100
129-
/usr/bin/env GOPATH=/usr go get github.com/bazelbuild/buildtools/buildifier
160+
sudo apt install -y build-essential cmake git gcc g++ cmake libcurl4-openssl-dev libssl-dev make zlib1g-dev
130161
```
131162

132-
#### Ubuntu (Trusty)
163+
#### Ubuntu (Trusty Tahr)
164+
165+
The default compiler on Ubuntu-14.04 (Trusty Tahr) doesn't fully support C++11.
166+
In addition, gRPC requires a newer version of OpenSSL than the one included
167+
in the system.
168+
169+
It is possible to work around these limitations on a *new* installation of
170+
Ubuntu-14.04, but there are [known issues][issue-913] working on a system where
171+
these libraries are already installed.
172+
173+
[issue-913]: https://github.com/GoogleCloudPlatform/google-cloud-cpp/issues/913
174+
175+
Nevertheless, the following steps are known to work:
133176

134177
```bash
135178
sudo apt update
136179
sudo apt install -y software-properties-common
137180
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
138181
sudo apt update
139-
sudo apt install abi-compliance-checker abi-dumper automake build-essential ccache clang clang-format cmake curl doxygen gawk git gcc g++ golang cmake libcurl4-openssl-dev libssl-dev libtool lsb-release make python-gunicorn python-httpbin tar wget zlib1g-dev
140-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
141-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
182+
sudo apt install -y cmake3 git gcc-4.9 g++-4.9 make wget zlib1g-dev
142183
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 100
143184
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100
185+
cd /var/tmp/
186+
sudo wget -q https://www.openssl.org/source/openssl-1.0.2n.tar.gz
187+
sudo tar xf openssl-1.0.2n.tar.gz
188+
cd /var/tmp/openssl-1.0.2n
189+
sudo ./Configure --prefix=/usr/local --openssldir=/usr/local linux-x86_64 shared
190+
sudo make -j $(nproc)
191+
sudo make install
192+
193+
cd /var/tmp/
194+
sudo wget -q https://curl.haxx.se/download/curl-7.61.0.tar.gz
195+
sudo tar xf curl-7.61.0.tar.gz
196+
cd /var/tmp/curl-7.61.0
197+
sudo ./configure
198+
sudo make -j $(nproc)
199+
sudo make install
144200
```
145201

146202
#### macOS (using brew)
@@ -149,7 +205,7 @@ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100
149205
brew install curl cmake
150206
```
151207

152-
#### Windows
208+
#### Windows (using vcpkg)
153209

154210
```bash
155211
set PROVIDER=vcpkg
@@ -188,8 +244,8 @@ cd build-output
188244
ctest --output-on-failure
189245
```
190246

191-
You will find compiled binaries in `build-output\` respective to their source directories.
192-
247+
You will find compiled binaries in `build-output\` respective to their
248+
source directories.
193249

194250
## Versioning
195251

ci/test-readme/Dockerfile.centos

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG DISTRO_VERSION=7
16+
FROM centos:${DISTRO_VERSION}
17+
MAINTAINER "Carlos O'Ryan <coryan@google.com>"
18+
19+
# Please keep the formatting in these commands, it is optimized to cut & paste
20+
# into the README.md file.
21+
22+
# We need the "Extra Packages for Enterprise Linux" for cmake3
23+
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
24+
RUN yum install -y centos-release-scl
25+
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
26+
RUN yum makecache
27+
RUN yum install -y devtoolset-7 cmake3 curl-devel git openssl-devel
28+
29+
# Install cmake3 + ctest3 as cmake + ctest.
30+
RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake
31+
RUN ln -sf /usr/bin/ctest3 /usr/bin/ctest
32+
33+
ARG CXX=g++
34+
ARG CC=gcc
35+
36+
WORKDIR /var/tmp/
37+
RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-cpp.git
38+
WORKDIR /var/tmp/google-cloud-cpp
39+
RUN git submodule update --init
40+
RUN scl enable devtoolset-7 -- cmake -H. -Bbuild-output
41+
RUN scl enable devtoolset-7 -- cmake --build build-output -- -j $(nproc)
42+
WORKDIR /var/tmp/google-cloud-cpp/build-output
43+
RUN scl enable devtoolset-7 -- ctest --output-on-failure

ci/test-readme/Dockerfile.debian

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG DISTRO_VERSION=stretch
16+
FROM debian:${DISTRO_VERSION}
17+
MAINTAINER "Carlos O'Ryan <coryan@google.com>"
18+
19+
# Please keep the formatting in these commands, it is optimized to cut & paste
20+
# into the README.md file.
21+
RUN apt update
22+
RUN apt install -y build-essential cmake git gcc g++ cmake libcurl4-openssl-dev libssl-dev make zlib1g-dev
23+
24+
ARG CXX=g++
25+
ARG CC=gcc
26+
27+
WORKDIR /var/tmp/
28+
RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-cpp.git
29+
WORKDIR /var/tmp/google-cloud-cpp
30+
RUN git submodule update --init
31+
RUN cmake -H. -Bbuild-output
32+
RUN cmake --build build-output -- -j $(nproc)
33+
WORKDIR /var/tmp/google-cloud-cpp/build-output
34+
RUN ctest --output-on-failure

ci/test-readme/Dockerfile.fedora

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG DISTRO_VERSION=28
16+
FROM fedora:${DISTRO_VERSION}
17+
MAINTAINER "Carlos O'Ryan <coryan@google.com>"
18+
19+
# Please keep the formatting in these commands, it is optimized to cut & paste
20+
# into the README.md file.
21+
RUN dnf makecache
22+
RUN dnf install -y clang cmake gcc-c++ git libcurl-devel make openssl-devel
23+
24+
ARG CXX=g++
25+
ARG CC=gcc
26+
27+
WORKDIR /var/tmp/
28+
RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-cpp.git
29+
WORKDIR /var/tmp/google-cloud-cpp
30+
RUN git submodule update --init
31+
RUN cmake -H. -Bbuild-output
32+
RUN cmake --build build-output -- -j $(nproc)
33+
WORKDIR /var/tmp/google-cloud-cpp/build-output
34+
RUN ctest --output-on-failure

ci/test-readme/Dockerfile.opensuse

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG DISTRO_VERSION=tumbleweed
16+
FROM opensuse:${DISTRO_VERSION}
17+
MAINTAINER "Carlos O'Ryan <coryan@google.com>"
18+
19+
# Please keep the formatting in these commands, it is optimized to cut & paste
20+
# into the README.md file.
21+
RUN zypper refresh
22+
RUN zypper install -y cmake gcc gcc-c++ git libcurl-devel libopenssl-devel make
23+
24+
RUN source /etc/os-release ; if [ "${NAME}" = "openSUSE Leap" ]; then \
25+
zypper refresh && zypper install -y gcc5 gcc5-c++; \
26+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 100; \
27+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 100; \
28+
fi
29+
30+
ARG CXX=g++
31+
ARG CC=gcc
32+
33+
WORKDIR /var/tmp/
34+
RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-cpp.git
35+
WORKDIR /var/tmp/google-cloud-cpp
36+
RUN git submodule update --init
37+
RUN cmake -H. -Bbuild-output
38+
RUN cmake --build build-output -- -j $(nproc)
39+
WORKDIR /var/tmp/google-cloud-cpp/build-output
40+
RUN ctest --output-on-failure

ci/test-readme/Dockerfile.ubuntu

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG DISTRO_VERSION=bionic
16+
FROM ubuntu:${DISTRO_VERSION}
17+
MAINTAINER "Carlos O'Ryan <coryan@google.com>"
18+
19+
# Please keep the formatting in these commands, it is optimized to cut & paste
20+
# into the README.md file.
21+
RUN apt update
22+
RUN apt install -y build-essential cmake git gcc g++ cmake libcurl4-openssl-dev libssl-dev make zlib1g-dev
23+
24+
ARG CXX=g++
25+
ARG CC=gcc
26+
27+
WORKDIR /var/tmp/
28+
RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-cpp.git
29+
WORKDIR /var/tmp/google-cloud-cpp
30+
RUN git submodule update --init
31+
RUN cmake -H. -Bbuild-output
32+
RUN cmake --build build-output -- -j $(nproc)
33+
WORKDIR /var/tmp/google-cloud-cpp/build-output
34+
RUN ctest --output-on-failure

0 commit comments

Comments
 (0)