[protobuf] Re: Creating Static C++ Library with Protobuf messages to be reused accross projects

2020-04-13 Thread Mayron Reis

has anyone found any solution to this problem?

Em quarta-feira, 21 de março de 2018 15:13:47 UTC-3, 
c.co...@axis-canada.com escreveu:
>
> Hi,
>
> I am trying to create a static lib with the message definitions to be 
> share across multiple CMake projects. At the moment, I have:
>
>- A Conan.io package with *protobuf *pre-comiled into static libs.
>- A *CommonDefinitions* project (with a dependency to the *protobuf* 
>package)
>   - From which I create a *CommonDefinitions* conan.io package 
>   containing the CommonDefinitions static library
>   - Project include a test Executable which uses the static library
>- A *EndUser* project (with a dependency to the *CommonDefinitions* 
>package and the *protobuf* package)
>
> Now, the test executable of the *CommonDefiniitons* project works as 
> expected and has access to the CommonDefinitions messages. However, the 
> *EndUser* project is not able to link, it complains about missing 
> references to protobuf static libraries, even though I also include the 
> protobuf package in the *EndUser* target_link_libraries project as well.
>
> Does anyone have an idea or had a similar problem?
>
> Thanks
>
> Here are the linker traces:
>
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function `protobuf_test_2eproto::protobuf_AssignDescriptors()':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:79: undefined reference to 
> `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string  
> std::char_traits, std::allocator > const&, 
> google::protobuf::internal::MigrationSchema const*, 
> google::protobuf::Message const* const*, unsigned int const*, 
> google::protobuf::MessageFactory*, google::protobuf::Metadata*, 
> google::protobuf::EnumDescriptor const**, 
> google::protobuf::ServiceDescriptor const**)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `protobuf_test_2eproto::protobuf_RegisterTypes(std::__cxx11::basic_string  
> std::char_traits, std::allocator > const&)':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:90: undefined reference to 
> `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata 
> const*, int)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function `protobuf_test_2eproto::AddDescriptorsImpl()':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:101: undefined reference to 
> `google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, 
> int)'
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:103: undefined reference to 
> `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char 
> const*, void (*)(std::__cxx11::basic_string, 
> std::allocator > const&))'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:251: undefined reference to 
> `google::protobuf::internal::WireFormat::SkipField(google::protobuf::io::CodedInputStream*,
>  
> unsigned int, google::protobuf::UnknownFieldSet*)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
>  
> const':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:294: undefined reference to 
> `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
>  
> const&, google::protobuf::io::CodedOutputStream*)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::InternalSerializeWithCachedSizesToArray(bool, 
> unsigned char*) const':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:330: undefined reference to 
> `google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet
>  
> const&, unsigned char*)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function `axis::system::test::TestData::ByteSizeLong() const':
> 

[protobuf] Re: Creating Static C++ Library with Protobuf messages to be reused accross projects

2019-02-17 Thread doron atuar
Hey, 
I'm struggling with a similar problem.
were you able to solve it?

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Re: Creating Static C++ Library with Protobuf messages to be reused accross projects

2018-03-22 Thread Edward Clark
Perhaps look at the link command and see if it includes the protobuf 
libraries as you expect, or post it here.

On Wednesday, March 21, 2018 at 2:13:47 PM UTC-4, c.co...@axis-canada.com 
wrote:
>
> Hi,
>
> I am trying to create a static lib with the message definitions to be 
> share across multiple CMake projects. At the moment, I have:
>
>- A Conan.io package with *protobuf *pre-comiled into static libs.
>- A *CommonDefinitions* project (with a dependency to the *protobuf* 
>package)
>   - From which I create a *CommonDefinitions* conan.io package 
>   containing the CommonDefinitions static library
>   - Project include a test Executable which uses the static library
>- A *EndUser* project (with a dependency to the *CommonDefinitions* 
>package and the *protobuf* package)
>
> Now, the test executable of the *CommonDefiniitons* project works as 
> expected and has access to the CommonDefinitions messages. However, the 
> *EndUser* project is not able to link, it complains about missing 
> references to protobuf static libraries, even though I also include the 
> protobuf package in the *EndUser* target_link_libraries project as well.
>
> Does anyone have an idea or had a similar problem?
>
> Thanks
>
> Here are the linker traces:
>
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function `protobuf_test_2eproto::protobuf_AssignDescriptors()':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:79: undefined reference to 
> `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string  
> std::char_traits, std::allocator > const&, 
> google::protobuf::internal::MigrationSchema const*, 
> google::protobuf::Message const* const*, unsigned int const*, 
> google::protobuf::MessageFactory*, google::protobuf::Metadata*, 
> google::protobuf::EnumDescriptor const**, 
> google::protobuf::ServiceDescriptor const**)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `protobuf_test_2eproto::protobuf_RegisterTypes(std::__cxx11::basic_string  
> std::char_traits, std::allocator > const&)':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:90: undefined reference to 
> `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata 
> const*, int)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function `protobuf_test_2eproto::AddDescriptorsImpl()':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:101: undefined reference to 
> `google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, 
> int)'
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:103: undefined reference to 
> `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char 
> const*, void (*)(std::__cxx11::basic_string std::allocator > const&))'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:251: undefined reference to 
> `google::protobuf::internal::WireFormat::SkipField(google::protobuf::io::CodedInputStream*,
>  
> unsigned int, google::protobuf::UnknownFieldSet*)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
>  
> const':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:294: undefined reference to 
> `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
>  
> const&, google::protobuf::io::CodedOutputStream*)'
> /home/toto/.conan/data/system-definitions/0.0/axis/stable/package/9755f981ac44041fa0948f05e49abfa3d3346131/lib/libsystem-definitions.a(test.pb.cc.o):
>  
> In function 
> `axis::system::test::TestData::InternalSerializeWithCachedSizesToArray(bool, 
> unsigned char*) const':
> /home/toto/gitlab/system/system-definitions/build-debug/Definitions/
> test.pb.cc:330: undefined reference to 
> `google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet
>  
> const&, unsigned char*)'
>