gRPC C++ Installation Issue

92 views
Skip to first unread message

John Leidel

unread,
Apr 22, 2020, 11:00:01 AM4/22/20
to grpc.io
All, its been quite some time since I last built+installed gRPC from source.  I'm attempting to build+install on Ubuntu 18.04 LTS from source and I can't seem to get the libgrpc++* libraries to install.  I'm following the directions on the gRPC building guide, but regardless of the version/options I choose, the build refuses to install the necessary libraries.  So far, I've tried the current master branch (HEAD), v1.28.1, v.1.27.2, v.1.25.0 and they all fail.  

Build method: 
$> git clone --recurse-submodules -b v1.28.1 https://github.com/grpc/grpc
$> cd grpc
$> mkdir -p cmake/build
$> cd cmake/build
$> cmake -DCMAKE_INSTALL_PREFIX=/home/user/grpc -DgRPC_INSTALL=ON ../../
$> make -j
$> make install

....where `/home/user/grpc` is a directory within my home directory.   I see the following libs installed: 
libcares.a  libprotobuf.a  libprotobuf-lite.a  libprotoc.a  libz.a  libz.so

libgrpc++.a (and its other variants) are built via cmake, but they're not installed.  As an aside, I also tried manually enabling the CPP plugin in the cmake build, but it delivers the same results.  

I've also tried building the helloworld test from within the source tree as directed by the instructions on Github.  It fails to find a cmake dependency from the install: 
CMake Error at /home/user/grpc/lib/cmake/grpc/gRPCConfig.cmake:12 (include):
  include could not find load file:

    /home/user/grpc/lib/cmake/grpc/gRPCTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:116 (find_package)


Any thoughts?  

Patrice Chalin

unread,
Apr 22, 2020, 11:08:32 AM4/22/20
to grpc.io
Hi John,

I recently updated the C++ Quick Start, which now describes how to "build and locally install gRPC before building and running this quick start’s Hello World example." I've tested the instructions on Ubuntu 18.04 LTS and haven't had any issues. Maybe you can give those instructions a try? (Which version of cmake are you using? You'll need 3.13+.)

Best,
Patrice

John Leidel

unread,
Apr 22, 2020, 11:22:28 AM4/22/20
to Patrice Chalin, grpc.io
Patrice, thanks for the quick response. I was, in fact, using the
updated C++ Quick Start directions. However, I did find that my CMake
version was slightly out of date (3.10.X). I'm updating CMake and
will report back as soon as I can get a clean build.
> --
> You received this message because you are subscribed to the Google Groups "grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/c002f687-423f-4e03-83ad-c6b11f806647%40googlegroups.com.

John Leidel

unread,
Apr 22, 2020, 11:38:47 AM4/22/20
to Patrice Chalin, grpc.io
Patrice, I updated CMake to something newer within range and the
build+install appears to work. I have some other issues to get ironed
out in order to sync our external packages with the updated Cmake
scripts, but I suspect this was the major issue. Thanks for the help!

best
john

Patrice Chalin

unread,
Apr 27, 2020, 2:55:10 PM4/27/20
to John Leidel, Jan Tattermusch, Eric Anderson, grpc.io
+Jan Tattermusch, Eric and I discussed the following during our Docs WG meeting: to avoid users facing this problem again, how about if we changed the min version of cmake from the current 3.5.1 to, say, 3.13

cmake_minimum_required(VERSION 3.13)

in either the C++ hello world cmake config:

Jan Tattermusch

unread,
May 4, 2020, 8:46:06 AM5/4/20
to Patrice Chalin, John Leidel, Eric Anderson, grpc.io
The problem with that is that cmake 3.13 is not available by default in many popular linux distributions.

e.g.
- debian stable has https://packages.debian.org/buster/cmake 3.13
- ubuntu18.04 only has cmake 3.10
- ubuntu16.04 only has cmake 3.5.1

On linux it's pretty painful to use a cmake version that's not installable by the package manager.

--

Jan Tattermusch

Software Engineer


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

    

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

John Leidel

unread,
May 4, 2020, 8:53:18 AM5/4/20
to Jan Tattermusch, Patrice Chalin, Eric Anderson, grpc.io
I don't know that it is necessarily painful, but it is certainly a very manual process.  Kitware has done a good job and providing stable cross-platform build scripts.  RHEL/CentOS distros are a bit more difficult.  Darwin 10.15 with the latest XCode installed provides CMake 3.6.2.  However, Homebrew provides 3.17.1.  The difficulty here is manual PATH munging in order to keep both XCode and gRPC happy.  

That being said, it would be preferred to have the gRPC build throw an error for incompatible CMake versions.

Patrice Chalin

unread,
May 4, 2020, 1:12:43 PM5/4/20
to John Leidel, Jan Tattermusch, Eric Anderson, grpc.io
On Mon, May 4, 2020 at 8:53 AM John Leidel <john....@gmail.com> wrote:
... That being said, it would be preferred to have the gRPC build throw an error for incompatible CMake versions.

I agree.

Jan Tattermusch

unread,
Jun 3, 2020, 3:23:10 AM6/3/20
to grpc.io
Coming back to this thread after a while:

The issue you ran into is actually that you tried to install grpc dependencies from submodules (https://github.com/grpc/grpc/blob/364461aab0a352c43ed93f77a18907f95be709dc/templates/CMakeLists.txt.template#L172)
and build you ran actually printed a warning that said your cmake version is too old for what you're trying to do: https://github.com/grpc/grpc/blob/3e2513c31a4417630f2b3519b4125c7e15152dc4/cmake/ssl.cmake#L58

Installing dependencies in "module" mode is documented here: https://github.com/grpc/grpc/blob/master/BUILDING.md#install-after-build

I'll look at the C++ quickstart instructions https://grpc.io/docs/languages/cpp/quickstart/ and see if they can be improved.
Reply all
Reply to author
Forward
0 new messages