首页 > 解决方案 > 找不到由“Protobuf”提供的具有以下任何名称的包配置文件: ProtobufConfig.cmake protobuf-config.cmake

问题描述

尝试为 GRPC 编译快速入门示例。

它会产生以下错误:

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)

我已经在其他类似问题上尝试了所有建议的解决方案,但无济于事。这些是对我不起作用的解决方案:

  1. 更改find_package(protobuf CONFIG REQUIRED)为大写find_package(Protobuf REQUIRED)
  2. 安装 pkg-config
  3. 这个线程

我找不到任何其他解决方案。任何帮助将不胜感激。

标签: cmakeprotocol-buffersgrpc

解决方案


我猜这很可能是由于 gRPC 存储库中缺少子模块造成的。你会在构建之前获得子模块吗?例如,您可以git clone --recurse-submodules -b v1.38.0 https://github.com/grpc/grpc为它运行。


推荐阅读