I face the same problem, and the scenoria is Binary A use the grpc++_reflection.a and libB.so first not link the grpc++_reflection.a, build the binaryA, and libB.so recompile with linking the grpc++_reflection.a, then binaryA fatal with the same error information.
在2019年2月12日星期二 UTC+8 23:31:29<Alex Stark> 写道: > Upon further debuging it appears the conflict is with > /src/proto/grpc/reflection/v1alpha/reflection.pb.cc being included > twice. Which makes sense given the error code. What I'm not understanding > is why that is considered a fatal error. > > And of course if there's anyway around it. > > > > On Monday, February 11, 2019 at 5:01:03 PM UTC-6, Alex Stark wrote: >> >> >> This might seem like an odd pattern, but I'm looking to retrofit an >> existing client/server framework with gRPC. That has led me to a question >> and an issue. >> >> FIrst, the question. The "Use Server Reflection in a C++ Client" secion >> of the Server Reflection Tutorial >> <https://github.com/grpc/grpc/blob/master/doc/server_reflection_tutorial.md> >> >> mentions using the grpc::ProtoReflectionDescriptorDatabase class as the >> basis of that interaction. That seems to require me to link >> in libgrpc++_proto_reflection_desc_db.a which as far as I can tell has no >> "install" option in the makefile provided. Is staticlly linking it from >> the grpc/lib/opts directory the recomended pattern or am I missing >> something? >> >> To try things out I went ahead and linked it into my client/server >> framework library directly. However, from there I'm having issues getting >> my test server to startup when linking in both my client/server dynamic >> library (that statically links libgrpc++_proto_reflectin_desc_db.a) >> and libgrpc++_reflection.so. The error in question is this: >> >> [libprotobuf ERROR google/protobuf/descriptor_database.cc:58] File >> already exists in database: >> src/proto/grpc/reflection/v1alpha/reflection.proto >> [libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: >> GeneratedDatabase()->Add(encoded_file_descriptor, size): >> terminate called after throwing an instance of >> 'google::protobuf::FatalException' >> what(): CHECK failed: >> GeneratedDatabase()->Add(encoded_file_descriptor, size): >> >> I'm planning to continue digging in to see if I can figure out why that's >> an issue, but the comment foujnd in descriptor.cc around this exception >> throw isn't initial obvious to me (as a novice) what exactly I might be >> doing wrong. Hoping the community might have some insight into whether or >> not those 2 libraries are inherently incompatable inside the same process. >> As far as I can tell I don't even get to the creation of the actual >> ProtoReflectionDescriptorDatabase construction the error happens while the >> process is starting up. >> >> Thanks in advance for any advice on those topics. >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/825f4674-0112-45a7-99ec-e662df27d4ebn%40googlegroups.com.