【问题标题】:Unable to generate client code using proto 3.0 buffer in gRPC无法在 gRPC 中使用 proto 3.0 缓冲区生成客户端代码
【发布时间】:2016-06-14 22:08:00
【问题描述】:

我正在尝试在 gRPC 中生成客户端和服务器代码。我已经从 github 安装了 grpc 目录并尝试生成 C++ 代码。我安装了 proto 编译器 3.0.0。

当我执行 protoc 时,我遇到了错误

$ protoc -I ../../protos/ --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin                                                                                                                                                  ../../protos/helloworld.proto
grpc_cpp_plugin: program not found or is not executable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

知道为什么我无法生成客户端/服务器代码

【问题讨论】:

  • 你有grpc_cpp_plugin吗?可以执行吗?
  • 我安装了 protoc 3.0.0,然后按照它说的方式运行 MAKE。但似乎它还没有创建 cpp_plugin。

标签: c++ go protocol-buffers grpc


【解决方案1】:

检查您的/usr/local/bin。它应该与其他语言的插件一起存在。

/usr/local/bin > ll total 71144 -rwxr-xr-x 1 root root 12721867 Oct 23 10:44 grpc_cpp_plugin* -rwxr-xr-x 1 root root 14509678 Oct 23 10:44 grpc_csharp_plugin* -rwxr-xr-x 1 root root 13339870 Oct 23 10:44 grpc_objective_c_plugin* -rwxr-xr-x 1 root root 12569518 Oct 23 10:44 grpc_python_plugin* -rwxr-xr-x 1 root root 12393363 Oct 23 10:44 grpc_ruby_plugin*

如果你有其他插件但没有 cpp,你可能在安装时忽略了一些东西。

如果在编译时尝试指定完整路径(即--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin)

如果您有多个版本的 protobuf,请检查您是否使用同一版本的 protoc 和插件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-02
    • 1970-01-01
    • 1970-01-01
    • 2011-08-23
    • 2010-10-09
    • 1970-01-01
    • 2020-05-11
    相关资源
    最近更新 更多