I am trying to compile my ROS node. This node compiles perfectly fine in Unix (running ROS Electric). Now, I am trying to compile it in Mac (running ROS Fuerte). The node depends on Google Protobuf, and I have installed protobuf successfully and also compiled my .proto file successfully. However, when I try to make my ROS node, I get some errors:
Linking CXX executable bin/mylib Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o "google::protobuf::DescriptorPool::generated_pool()", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::DescriptorPool::FindFileByName(std::basic_string<char, std::char_traits, std::allocator > const&) const", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o protobuf::CommandObj::MergeFrom(protobuf::CommandObj const&)in maverick_cmd.pb.o protobuf::CommandObj::MergeFrom(google::protobuf::Message const&)in maverick_cmd.pb.o
The list of errors continues for quite some time... it's doubtful that this helps, but here is the full list of errors...
Linking CXX executable bin/mylib Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o "google::protobuf::DescriptorPool::generated_pool()", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::DescriptorPool::FindFileByName(std::basic_string, std::allocator > const&) const", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o protobuf::CommandObj::MergeFrom(protobuf::CommandObj const&)in maverick_cmd.pb.o protobuf::CommandObj::MergeFrom(google::protobuf::Message const&)in maverick_cmd.pb.o "google::protobuf::internal::LogMessage::operator, std::allocator > const&, google::protobuf::io::CodedOutputStream*)", referenced from: protobuf::CommandObj::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in maverick_cmd.pb.o "google::protobuf::internal::WireFormatLite::WriteFloat(int, float, google::protobuf::io::CodedOutputStream*)", referenced from: protobuf::CommandObj::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in maverick_cmd.pb.o "google::protobuf::internal::WireFormatLite::WriteDouble(int, double, google::protobuf::io::CodedOutputStream*)", referenced from: protobuf::CommandObj::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in maverick_cmd.pb.o "google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet const&, google::protobuf::io::CodedOutputStream*)", referenced from: protobuf::CommandObj::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in maverick_cmd.pb.o "google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int*)", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::basic_string, std::allocator >*)", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::io::CodedInputStream::ReadLittleEndian32Fallback(unsigned int*)", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::io::CodedInputStream::ReadLittleEndian64Fallback(unsigned long long*)", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::internal::WireFormat::SkipField(google::protobuf::io::CodedInputStream*, unsigned int, google::protobuf::UnknownFieldSet*)", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::io::CodedInputStream::ReadTagFallback()", referenced from: protobuf::CommandObj::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in maverick_cmd.pb.o "google::protobuf::UnknownFieldSet::ClearFallback()", referenced from: protobuf::CommandObj::Clear() in maverick_cmd.pb.o "google::protobuf::UnknownFieldSet::~UnknownFieldSet()", referenced from: protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::CommandObj(protobuf::CommandObj const&)in maverick_cmd.pb.o "google::protobuf::Message::~Message()", referenced from: protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::New() constin maverick_cmd.pb.o protobuf::CommandObj::~CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::CommandObj(protobuf::CommandObj const&)in maverick_cmd.pb.o protobuf::CommandObj::CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::CommandObj()in maverick_cmd.pb.o ... "google::protobuf::UnknownFieldSet::UnknownFieldSet()", referenced from: protobuf::CommandObj::New() constin maverick_cmd.pb.o protobuf::CommandObj::CommandObj(protobuf::CommandObj const&)in maverick_cmd.pb.o protobuf::CommandObj::CommandObj()in maverick_cmd.pb.o protobuf::CommandObj::CommandObj()in maverick_cmd.pb.o protobuf::protobuf_AddDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::internal::VerifyVersion(int, int, char const*)", referenced from: protobuf::protobuf_AddDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)", referenced from: protobuf::protobuf_AddDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::basic_string, std::allocator > const&))", referenced from: protobuf::protobuf_AddDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::internal::OnShutdown(void (*)())", referenced from: protobuf::protobuf_AddDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(google::protobuf::Descriptor const*, google::protobuf::Message const*)", referenced from: protobuf::(anonymous namespace)::protobuf_RegisterTypes(std::basic_string, std::allocator > const&)in maverick_cmd.pb.o "google::protobuf::Message::GetTypeName() const", referenced from: vtable for protobuf::CommandObjin maverick_cmd.pb.o "google::protobuf::Message::InitializationErrorString() const", referenced from: vtable for protobuf::CommandObjin maverick_cmd.pb.o "google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)", referenced from: vtable for protobuf::CommandObjin maverick_cmd.pb.o "google::protobuf::Message::DiscardUnknownFields()", referenced from: vtable for protobuf::CommandObjin maverick_cmd.pb.o "google::protobuf::Message::SpaceUsed() const", referenced from: vtable for protobuf::CommandObjin maverick_cmd.pb.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[2]: *** [bin/mylib] Error 1 make[1]: *** [CMakeFiles/mylib.dir/all] Error 2 make: *** [all] Error 2
I'm thinking that the errors have something to do with the protobuf dependency. Also, I have a file in my node ./libs/libmylib.so, and I don't actually know what the purpose of this file is, but it is referenced in my CMakeLists.txt file...
rosbuild_add_library(mylib src/maverick_cmd.pb.cc)
Thanks for the help.
Originally posted by amittleider on ROS Answers with karma: 227 on 2012-05-27
Post score: 1