Skip to content
Advertisement

Building gRPC C++ with CMake on Linux

I’m trying to build gRPC (cpp) using CMake, but running into errors. I am able to successfully build gRPC with make per the instructions on the gRPC cpp page. Using make is deprecated, but CMake isn’t working for me.

After following the instructions for downloading, cloning etc., I go to the “Building with CMake”, where it says for Linux/Unix, do this:

JavaScript

For me, it fails at the 3rd line (cmake). The following is the output:

JavaScript

Those files (cmake/<package name>.cmake) don’t exist in the cmake/ directory on my system. I’m not sure what in the CMakeLists.txt file would cause them to appear there.

Researching this issue, I tried various combinations of cmake options such as -DBUILD_SHARED_LIBS=ON, -DgRPC_INSTALL=ON, and -DgRPC<package_name>_PROVIDER=package for each of the fails listed above. I always get the same errors. Finally, I tried running the run_distrib_test_cmake.sh script. It eventually failed the same way.

Any ideas?

Advertisement

Answer

The third party CMake files (e.g. cmake/zlib.cmake) do exist in the GitHub repository you cloned (see here). Please be sure your repository finished cloning completely, to include all of the submodules, per the gRPC build documentation:

Run from grpc directory after cloning the repo with –recursive or updating submodules.

JavaScript

So be sure everything is cloned with:

JavaScript

or

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement