【问题标题】:GRPC C++ Build from Source Fatal errorGRPC C++ Build from Source 致命错误
【发布时间】:2017-10-31 10:54:27
【问题描述】:

想尝试使用 GRPC C++(有 Java 版本的经验),我正在尝试按照https://github.com/grpc/grpc/blob/master/INSTALL.md 上发布的安装说明中的说明从源代码构建 GRPC C++

按照这些说明构建失败:

[CXX]     Compiling src/cpp/util/time_cc.cc
[HOSTCXX] Compiling src/compiler/cpp_generator.cc
In file included from ./src/compiler/cpp_generator.h:29:0,
             from src/compiler/cpp_generator.cc:21:
./src/compiler/config.h:25:10: fatal error: google/protobuf/compiler/code_generator.h: No such file or directory
#include <google/protobuf/compiler/code_generator.h>
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

我正在尝试在 Ubuntu 17.10 上构建它

有人可以帮忙吗?

【问题讨论】:

  • 我在 Debian 9 上完成了这项工作,它与 Ubuntu 17.10 相当接近,所以这似乎很有可能。话虽如此,从您的错误消息中跳出来的第一件事是您是否抓住了 git 子模块并将它们放在正确的目录中?
  • 好吧,在克隆了 git repo 之后,我也做了:“git submodule update --init” 说明中没有提到关于移动文件/目录的任何内容?
  • protobuf 依赖可能已经改变,grpc 没有相应地更新它的代码。 grpc 的构建状态当前为 404'd。这是首先不使用 git 子模块的原因之一,但是您在这里被困在使用它们。你能检查一下 protobuf 子模块,看看那个头文件确实存在吗?
  • 刚刚检查,它确实存在于“third_party/protobuf/src/google/protobuf/compiler”中。我认为它可能已经在我的机器上安装了协议。我的机器上似乎已经安装了 protoc。会不会试图检查那个?
  • 如果 CMake 更喜欢该安装,那么可能。我在 Vagrant 盒子上进行了构建,因此系统环境干净且最小。

标签: c++ ubuntu grpc


【解决方案1】:

它看起来像 protobuf 坏了的主人。切换到v3.4.1后编译成功:

cd third_party/protobuf/
git checkout v3.4.1
cd -
sudo make HAS_SYSTEM_PROTOBUF=false install   

【讨论】:

    【解决方案2】:

    很可能工作站上安装了与 grpc 不兼容的 protobuf 版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多