-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c++: gRPC service descriptors are missing if the source proto has no messages defined #4221
Comments
What you observed is most likely due to the linker dropping unused symbols (i.e., the descriptor registering code is not reachable from your application code so they got removed by linker). Besides adding a dummy message and referencing it in C++ code, there are a few other options:
|
|
It's unclear if these are still needed given a number of protobuf library bumps, changes to the API build system and protocolbuffers/protobuf#4221. Removing the target doesn't cause any tests to fail. Risk level: Low Testing: bazel test //test/... This PR merging is conditional on the Envoy Mobile team confirming that there is no breakage. Signed-off-by: Harvey Tuch <htuch@google.com>
It seems that if my protobuf file consists of a single service, and I link against the resulting
.pb.h
then the service descriptor is missing from the generated descriptor pool. For context, this is happening in Envoy (https://github.com/envoyproxy/envoy/blob/master/source/common/upstream/cds_api_impl.cc#L40) using Bazel to generate protobuf files.The workaround is to (1) add a dummy message to the service proto; (2) instantiate the dummy message from the resulting
.pb.h
file.cc @htuch
The text was updated successfully, but these errors were encountered: