protoc - Server reflection doesn't work after using bazel build with static linking - Stack Overflow

We have a grpc server written in C++, our users sometimes make grpc calls via grpc_cli, all work well.

We have a grpc server written in C++, our users sometimes make grpc calls via grpc_cli, all work well. With "grpc_cli ls host:port -l", all registered grpc services are printed.

Recently I changed the grpc server to use bazel build and found only the service in default proto "service ServerReflection" can be printed in grpc_cli output. After some investigations, I found two approaches can solve the issue:

  1. Add "linkstatic=False" in bazel's cc_binary rule when I build the grpc server.
  2. Since #1 works, I compared the dynamically linked dependencies with the unworkable version, and found "libutf8_range.so"(belongs to protoc-3.26.1) is not dynamically linked, so I tried to dynamically link it and it works with no need to set "linkstatic=False".

From the grpc doc, it says "C++ Server Reflection is an add-on library, libgrpc++_reflection. To enable C++ server reflection, you can link this library to your server binary.", actually the libgrpc++_reflection is dynamically linked in the unworkable binary already. Why server reflection works only when "libutf8_range.so" is dynamically linked?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745036615a4607557.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信