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:
- Add "linkstatic=False" in bazel's cc_binary rule when I build the grpc server.
- 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条)