Using protobuf 2.5.0 c++ in Xcode 5.1.1 on OSX 10.9.2

364 views
Skip to first unread message

Florian Mosleh

unread,
May 17, 2014, 12:31:54 PM5/17/14
to prot...@googlegroups.com
Hello,

I've been scouring the interwebs for the last two days, trying to get this to work but I seem to be getting stuck on the same issue. Though I have looked multiple places for possible solutions, most of the solutions seem to be targeted towards iOS devs (not me) or people using Objective-C (also not me).

I've successfully generated a protobuf classes from a .proto file and imported it into my project. Added "/usr/local/includes" to my header search path and (as a probably futile attempt at resolving this) added "/usr/local/lib" where the static libs from compiling protobuf wound  up.

When I try to build my code, the code seems to compile, but then I get linker errors like this:

Undefined symbols for architecture x86_64:

  "google::protobuf::Message::GetTypeName() const", referenced from:

      vtable for CueStack_ParamState in ginkgo.pb.o

      vtable for CueStack_ParamTable in ginkgo.pb.o

      vtable for CueStack_CueValues in ginkgo.pb.o

      vtable for CueStack in ginkgo.pb.o

  "google::protobuf::Message::SpaceUsed() const", referenced from:

      vtable for CueStack_ParamState in ginkgo.pb.o

      vtable for CueStack_ParamTable in ginkgo.pb.o

      vtable for CueStack_CueValues in ginkgo.pb.o

      vtable for CueStack in ginkgo.pb.o

  "vtable for google::protobuf::internal::FunctionClosure0", referenced from:

      google::protobuf::internal::FunctionClosure0::FunctionClosure0(void (*)(), bool) in ginkgo.pb.o

  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

  "google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int*)", referenced from:

      google::protobuf::io::CodedInputStream::ReadVarint32(unsigned int*) in ginkgo.pb.o

  "google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)", referenced from:

      google::protobuf::io::CodedOutputStream::VarintSize32(unsigned int) in ginkgo.pb.o

  "google::protobuf::GoogleOnceInitImpl(long*, google::protobuf::Closure*)", referenced from:

      google::protobuf::GoogleOnceInit(long*, void (*)()) in ginkgo.pb.o

I have already tried changing the compiler flags when I build protobuf to this:
./configure CC=clang CXX="clang++ -std=c++11 -stdlib=libc++" CXXFLAGS="-O3" 

based on this discussion:

this isn't resolving my issue. 

Any advice is greatly appreciated since protobuf looks like it could resolve a lot of my serialization needs, more elegantly and json.

Thank you!

 
Message has been deleted

Bo Yang

unread,
Sep 8, 2017, 6:55:19 PM9/8/17
to Michael Cheung, Protocol Buffers
Please send an issue to our github repository and provide way to reproduce the bug.

On Thu, Aug 31, 2017 at 12:14 PM Michael Cheung <mcheu...@gmail.com> wrote:
I am having a similar issue when I am trying to build this open source project https://github.com/scrosby/OSM-binary. Wondering if you ever resolve this.

c++ -L/usr/local/Cellar/protobuf/3.4.0/include -shared -Wl,-install_name,libosmpbf.so.1 -o libosmpbf.so fileformat.pb.o osmformat.pb.o


Undefined symbols for architecture x86_64:


  "google::protobuf::MessageLite::~MessageLite()", referenced from:


      OSMPBF::protobuf_AddDesc_fileformat_2eproto() in fileformat.pb.o


      OSMPBF::Blob::Blob() in fileformat.pb.o


      OSMPBF::BlobHeader::BlobHeader() in fileformat.pb.o


      OSMPBF::Blob::Blob() in fileformat.pb.o


      OSMPBF::Blob::Blob(OSMPBF::Blob const&) in fileformat.pb.o


      OSMPBF::Blob::Blob(OSMPBF::Blob const&) in fileformat.pb.o


      OSMPBF::Blob::~Blob() in fileformat.pb.o


      ...


  "google::protobuf::GoogleOnceInitImpl(long*, google::protobuf::Closure*)", referenced from:


      OSMPBF::Blob::SharedCtor() in fileformat.pb.o


      OSMPBF::BlobHeader::SharedCtor() in fileformat.pb.o


      OSMPBF::HeaderBlock::SharedCtor() in osmformat.pb.o


      OSMPBF::StringTable::SharedCtor() in osmformat.pb.o


  "google::protobuf::io::CodedInputStream::ReadTagFallback()", referenced from:


      OSMPBF::Blob::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in fileformat.pb.o


      OSMPBF::BlobHeader::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in fileformat.pb.o


      OSMPBF::HeaderBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::HeaderBBox::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveGroup::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::StringTable::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      ...


  "google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int*)", referenced from:


      OSMPBF::Blob::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in fileformat.pb.o


      OSMPBF::BlobHeader::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in fileformat.pb.o


      OSMPBF::HeaderBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveGroup::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Info::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseInfo::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      ...


  "google::protobuf::io::CodedInputStream::ReadVarint64Fallback(unsigned long long*)", referenced from:


      OSMPBF::HeaderBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::HeaderBBox::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Info::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseInfo::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      bool google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<long long, (google::protobuf::internal::WireFormatLite::FieldType)18>(int, unsigned int, google::protobuf::io::CodedInputStream*, google::protobuf::RepeatedField<long long>*) in osmformat.pb.o


      bool google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<bool, (google::protobuf::internal::WireFormatLite::FieldType)8>(int, unsigned int, google::protobuf::io::CodedInputStream*, google::protobuf::RepeatedField<bool>*) in osmformat.pb.o


      ...


  "google::protobuf::io::CodedInputStream::PopLimit(int)", referenced from:


      OSMPBF::HeaderBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveGroup::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseInfo::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Node::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseNodes::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Way::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      ...


  "google::protobuf::io::CodedInputStream::PushLimit(int)", referenced from:


      OSMPBF::HeaderBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveBlock::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::PrimitiveGroup::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseInfo::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Node::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::DenseNodes::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Way::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      ...


  "google::protobuf::io::CodedOutputStream::VarintSize64(unsigned long long)", referenced from:


      OSMPBF::HeaderBlock::ByteSize() const in osmformat.pb.o


      OSMPBF::HeaderBBox::ByteSize() const in osmformat.pb.o


      OSMPBF::PrimitiveBlock::ByteSize() const in osmformat.pb.o


      OSMPBF::PrimitiveGroup::ByteSize() const in osmformat.pb.o


      OSMPBF::Info::ByteSize() const in osmformat.pb.o


      OSMPBF::DenseInfo::ByteSize() const in osmformat.pb.o


      OSMPBF::ChangeSet::ByteSize() const in osmformat.pb.o


      ...


  "google::protobuf::io::CodedOutputStream::WriteVarint32(unsigned int)", referenced from:


      OSMPBF::DenseInfo::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in osmformat.pb.o


      OSMPBF::Node::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in osmformat.pb.o


      OSMPBF::DenseNodes::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in osmformat.pb.o


      OSMPBF::Way::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in osmformat.pb.o


      OSMPBF::Relation::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in osmformat.pb.o


      OSMPBF::Relation::SerializeWithCachedSizes(google::protobuf::io::CodedOu

Reply all
Reply to author
Forward
0 new messages