Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 657 by abys...@gmail.com: Unnecessary dependency against protobuf in third-level targets.
http://code.google.com/p/protobuf/issues/detail?id=657

I have C++ generated file, say `a.pb.cc`, and I link it into shared library `a.so`. This library is also linked against `libprotobuf.so`.

When I do include `a.pb.h` in another file, say `test.cc`, I can't link it into executable `test` without adding dependency on `libprotobuf.so`: otherwise, I get undefined symbols errors, like:

"google::protobuf::internal::RepeatedPtrFieldBase::Reserve(int)"
"google::protobuf::internal::kEmptyString"
"google::protobuf::internal::ExtensionSet::ReleaseMessage(int, google::protobuf::MessageLite const&)" "google::protobuf::internal::ExtensionSet::MutableMessage(int, unsigned char, google::protobuf::MessageLite const&, google::protobuf::FieldDescriptor const*)"

The sum-up of dependencies:

1) test (test.cc includes a.pb.h) depends on a.so (a.pb.cc includes a.pb.h)
2) a.so (a.pb.cc includes a.pb.h) depends on libprotobuf.so
3) test (test.cc includes a.pb.h) depends on libprotobuf.so (!)

The possible reason is that I don't know enough about the linking.
The other possible reason is a design flaw in generated files - I don't see any particular reason to link against protobuf every target that already links against generated protobuf files or just includes some .pb.h

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to