gRPC

How to build gRPC from source on Arch Linux

Here is some info on how to build gRPC from source on Arch Linux.
I found it was not well documented in the original manual (see https://github.com/grpc/grpc/blob/master/BUILDING.md).

Install some packages via pacman:
> sudo pacman -Sy
> sudo pacman -S python2-yaml python2-mako

Navigate into the directory where you want to have a folder "grpc" containing the sources of gRPC.

At the time of writing,
> curl -L https://grpc.io/release
returns "v1.19.0".

However, for Arch Linux, you need to specify "v1.20.0-pre1":

> git clone -b v1.20.0-pre1 https://github.com/grpc/grpc

> cd grpc

edit Makefile template: diff --git a/templates/Makefile.template b/templates/Makefile.template index 71391f8139..41ea5ee3f0 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -127,7 +127,7 @@ # General settings. # You may want to change these depending on your system. - prefix ?= /usr/local + prefix ?= /usr PROTOC ?= protoc DTRACE ?= dtrace

> git submodule update --init -j 8

> env CXXFLAGS="-Wno-class-memaccess -Wno-stringop-truncation" make -j 8

> vi .gitmodules

Comment out the line " branch = cares-1_12_0"
=> "# branch = cares-1_12_0"

> git submodule update --init

> git submodule update --remote

If you encounter warnings like "warning: unable to rmdir 'third_party/googletest': the directory is not empty" in the previous step, just do "rm -rf third_party/googletest" and issue "git submodule update --remote" again.

> tools/buildgen/generate_projects.sh

> env CXXFLAGS="-Wno-tautological-compare -Wno-class-memaccess -Wno-ignored-qualifiers -Wno-stringop-truncation" make prefix=/usr -j 8

> sudo make install

Now also build and install protobuf:

> cd third_party/protobuf

> ./autogen.sh

> ./configure --prefix=/usr

> make -j 8

> sudo make install