duanrou5680
2016-03-02 07:13
浏览 329

无法使用gRPC中的proto 3.0缓冲区生成客户端代码

I am trying to generate client and server code in gRPC. I have installed grpc directory from github and trying to generate C++ code. I installed proto compiler 3.0.0.

When I am executing protoc i am getting below error

$ 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.

Any idea why I am not able to generate client/server code

图片转代码服务由CSDN问答提供 功能建议

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

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

  $ protoc -I ../../protos/ --grpc_out  =。  --plugin = protoc-gen-grpc = grpc_cpp_plugin ../../protos/helloworld.proto
grpc_cpp_plugin:找不到程序或不可执行
--grpc_out:protoc-gen-grpc:插件失败,状态码为1  。
   
 
 

任何想法为何我无法生成客户端/服务器代码

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushen1026 2016-03-02 08:50
    已采纳

    Check your /usr/local/bin. It should be there along with plugins for other languages.

    /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*

    If you do have other plugins but not cpp you probably overlooked something while installing.

    If it's there try to specify full path when compiling (i.e. --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin)

    If you have multiple version of protobuf check if you use protoc and plugin from the same one.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题