Ask Your Question
1

Protobuf dependency in ROS Fuerte/MacOSX

asked 2012-05-27 08:59:00 -0600

amittleider gravatar image

updated 2014-01-28 17:12:28 -0600

ngrennan gravatar image

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<char="">, std::allocator<char> > 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<char, std::char_traits<char="">, std::allocator<char> > 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<<(char const)", 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::LogFinisher::operator=(google::protobuf::internal::LogMessage&)", 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::~LogMessage()", 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::MessageFactory::generated_factory()", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor const, google::protobuf::Message const, int const, int, int, int, google::protobuf::DescriptorPool const, google::protobuf::MessageFactory, int)", referenced from: protobuf::protobuf_AssignDesc_maverick_5fcmd_2eproto() in maverick_cmd.pb.o "google::protobuf::UnknownFieldSet::MergeFrom(google::protobuf::UnknownFieldSet const&)", referenced from: protobuf::CommandObj::MergeFrom(protobuf::CommandObj const&)in maverick_cmd.pb.o "typeinfo for google::protobuf::Message", referenced from: protobuf::CommandObj::MergeFrom(google::protobuf::Message const&)in maverick_cmd.pb.o typeinfo for protobuf::CommandObjin maverick_cmd.pb.o "google::protobuf::internal::ReflectionOps::Merge(google::protobuf::Message const&, google::protobuf::Message)", referenced from: protobuf::CommandObj::MergeFrom(google::protobuf::Message const&)in maverick_cmd.pb.o "google::protobuf::io ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-05-27 09:48:58 -0600

Mac gravatar image

Are you linking against the protobuf library? Is it, per chance, only built for 32-bit (or only 64-bit) and you're building everything else using the other architecture?

(Tangential: why protobufs? ROS messages serve the same purpose...)

edit flag offensive delete link more

Comments

1

Could you expand a bit? It's possible that I am not linking against the protobuf library, but I'm not exactly sure how. On your other comment, I am using protobuf is because I am using a GUI written in Java and communicating through a socket with ROS. I am open to other solutions if you have them.

amittleider gravatar imageamittleider ( 2012-05-27 13:17:15 -0600 )edit

Could you expand a bit? It's possible that I am not linking against the protobuf library, but I'm not exactly sure how.

amittleider gravatar imageamittleider ( 2012-05-27 13:17:15 -0600 )edit

ROSJava is a (potentially) better solution to that problem. Do you have a target_link_libraries somewhere in your CMakeLists?

Mac gravatar imageMac ( 2012-05-27 16:25:29 -0600 )edit

ROSJava is a great idea! However, I am also having problems with that. I have also made a post about that issue here: http://answers.ros.org/question/34857/rosjava-on-macos-fail-to-build-roscore/ . I have target_link_libraries(publisher protobuf) in my CMakeLists. Is this correct?

amittleider gravatar imageamittleider ( 2012-05-28 03:23:28 -0600 )edit

Thanks a lot for the help, Mac. Your idea inspired me to add the line "rosbuild_add_library(publisher src/maverick_cmd.pb.cc)", which fixed the issue. I do agree that rosjava is a better solution, but this is my fallback in case I can't get that working.

amittleider gravatar imageamittleider ( 2012-05-28 03:55:07 -0600 )edit

Glad I could help. Upvote and accept my answer? (Karma!)

Mac gravatar imageMac ( 2012-05-28 07:56:36 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-27 08:59:00 -0600

Seen: 946 times

Last updated: May 27 '12