By user2669704

2019-06-27 15:40:46 8 Comments

I'm trying to integrate grpc into C++ projects. but I found the only way is download all source code and compile it by my self.

Is there any way to get a precompile .so/.a file which I can link against and a grpc_cpp_plugin for Linux?

Or is it impossible for c++ to do so and why?


@hansi_reit 2019-08-13 07:10:10

If you are looking for precompiled gRPC libraries you should go with vcpkg. I was also trying to cross compile gRPC, without building the library itself. With vcpkg I achieved this quite well. There are just a few steps to set this up:

  1. Pull vcpkg from GitHub and follow the instructions to set it up
  2. Install grpc with "./vcpkg install grpc"
  3. Set CMAKE_TOOLCHAIN_FILE in your CMakeLists.txt to the "vcpkg.cmake"-file in your vcpkg-folder
  4. Add gRPC in your CMakeLists.txt

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.1)

    set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
    set(CMAKE_TOOLCHAIN_FILE "/path_to_vcpkg/scripts/buildsystems/vcpkg.cmake")


find_package(gRPC CONFIG REQUIRED)


add_executable(${PROJECT_NAME} ${Bar})

target_link_libraries(${PROJECT_NAME} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc_cronet)

In the Folder path_to_vcpkg/packages/grpc_x64-PLATFORM/tools/grpc you will find all the precompiled grpc-plugins for your platform (also grpc_cpp_plugin).


  • easy to set up
  • vcpkg is available for all common plattforms
  • if a package isn't needed anymore you can just delete the folder in "path_to_vcpkg/packages"
  • includes all the gRPC tools you need


  • the "path_to_vcpkg/packages" folder gets quite big after some packages installed

@zmike 2019-06-27 16:44:18

Is there any way to get a precompile .so/.a file which I can link against and a grpc_cpp_plugin for Linux?

To answer this question, the gRPC C++ plugin currently requires manual build and install as stated here:

That means that there are currently no precompiled gRPC C++ plugins.

@user2669704 2019-06-28 04:55:29

I looked at this too. But why the official doesn't provide precompiled version as they provide for all other languages?

@zmike 2019-06-29 20:53:15

@user2669704 That's left to speculation. Too many different types of systems and configurations maybe?

Related Questions

Sponsored Content

25 Answered Questions

[SOLVED] What is the "-->" operator in C++?

10 Answered Questions

1 Answered Questions

[SOLVED] The Definitive C++ Book Guide and List

  • 2008-12-23 05:23:56
  • grepsedawk
  • 2386534 View
  • 4243 Score
  • 1 Answer
  • Tags:   c++ c++-faq

38 Answered Questions

[SOLVED] Why is "using namespace std;" considered bad practice?

26 Answered Questions

26 Answered Questions

[SOLVED] Why do we need virtual functions in C++?

40 Answered Questions

11 Answered Questions

24 Answered Questions

[SOLVED] Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition

19 Answered Questions

Sponsored Content