2

Trying to compile the quick start example for GRPC.

It produces these errors:

CMake Error at /home/priya/grpc/examples/cpp/cmake/common.cmake:101 (find_package):
  Could not find a package configuration file provided by "Protobuf" with any
  of the following names:

    ProtobufConfig.cmake
    protobuf-config.cmake

  Add the installation prefix of "Protobuf" to CMAKE_PREFIX_PATH or set
  "Protobuf_DIR" to a directory containing one of the above files.  If
  "Protobuf" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:24 (include)

I have tried all the proposed solutions for this on other similar questions but to no avail. These are the solutions that did not work for me:

  1. Changing find_package(protobuf CONFIG REQUIRED) to an uppercase find_package(Protobuf REQUIRED)
  2. Installing pkg-config
  3. This thread

I could not find any other solutions. Any help would be greatly appreciated.

  • 1
    "I have tried all the proposed solutions for this" -- you need to _show us_ exactly what you have tried by providing at least the exact CMake commands you used to get that error message. – Alex Reinking Jul 06 '21 at 16:43
  • Hi Alex, I provided the exact CMake commands that produced this error message with the quick start link I provided at the top of the question. The instructions on this page led me to these errors. – Priyata Kaneria Jul 07 '21 at 14:47

4 Answers4

1

So the problem is I am new with bash scripts. I had copied and pasted the instructions in quick start into a bash script so that we could integrate the gRPC repository into our repo smoothly without having to build manually each time.

This problem was caused by incorrectly calling the script, which meant the environment variable for the install directory was never getting set correctly and was remaining an empty value. You must put source before calling the file, e.g source ./grpcSetup.sh. Please read this other stackoverflow question that explains the problem more clearly.

0

It's likely to be caused by lack of submodules in the gRPC repo, I guess. Would you get submodules before build? You can run git clone --recurse-submodules -b v1.38.0 https://github.com/grpc/grpc for it, as an example.

Esun Kim
  • 189
  • 1
  • Hi Esun, thanks so much for your reply. I have tried downloading the submodules recursively before build as you have suggested which didn't work either. I have a feeling it has something to do with the install directory path. – Priyata Kaneria Jul 08 '21 at 09:11
0

Have you compiled and installed grpc before? I get this cmake error today and I run make install in the directory of builded grpc and it works now.

0

While installing GRPC, a variable is set that points to installation folder of GRPC.

mkdir -p $MY_INSTALL_DIR

If we change name MY_INSTALL_DIR to other, then that has to changed in CMakeList.txt file , hence error. To avoid and to keep it simple just use same name as mentioned in documentation.

rawrex
  • 4,044
  • 2
  • 8
  • 24
Shruthi H R
  • 9
  • 1
  • 4