tu-darmstadt-ros-pkg / hector_navigation

hector_navigation provides packages related to navigation of unmanned vehicles in USAR environments.
125 stars 90 forks source link

Patch for building from source on Mac OS X #5

Open spmaniato opened 8 years ago

spmaniato commented 8 years ago

I had trouble building hector_navigation from source on Mac OS X, whereas it seemed to be working just fine on Ubuntu 14.04.x. Both running ROS Indigo. Specifically, I was building this subset of hector_navigation: https://github.com/Maidbot/hector_exploration

I'm opening this issue more as a note for people who might encounter the same compiler / linker errors (see end of this issue). I'm not confident enough in my understanding of what's going on to submit a proper pull request.

In short, in order to build on OS X, I had to:

This is the patch / commit: https://github.com/Maidbot/hector_exploration/commit/920b1d6d706630d2ed33dd7dac631c5abfacd910

Here's a sampling from the errors I was getting:

Undefined symbols for architecture x86_64:
  "ros::NodeHandle::NodeHandle(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&)", referenced from:
      pose_follower::HectorPathFollower::initialize(tf::TransformListener*) in hector_path_follower.cpp.o
  "ros::NodeHandle::~NodeHandle()", referenced from:
      pose_follower::HectorPathFollower::initialize(tf::TransformListener*) in hector_path_follower.cpp.o
  "ros::Subscriber::~Subscriber()", referenced from:
      pose_follower::HectorPathFollower::HectorPathFollower() in hector_path_follower.cpp.o
  "ros::DurationBase<ros::Duration>::fromSec(double)", referenced from:
      ros::Duration::Duration(double) in hector_path_follower.cpp.o
meyerj commented 8 years ago

Your commit https://github.com/Maidbot/hector_exploration/commit/920b1d6d706630d2ed33dd7dac631c5abfacd910 looks good to me and should be cherry-picked to the catkin branch. Or can you open a pull request with only that commit please? Thank you very much!

I wonder why these packages ever compiled successfully in Linux without the target_link_libraries(...) commands.

spmaniato commented 8 years ago

Thanks for the quick reply Johannes! Yeah, I can definitely open a pull request.

Are you sure it should include the removal of:

<cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -Wl,-rpath,${prefix}/lib -lhector_exploration_planner"/>
<cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -Wl,-rpath,${prefix}/lib -lhector_path_follower"/>

from the two package manifests? I'm not sure what they're meant to accomplish but they definitely prevent compilation on OS X. I'll test in Ubuntu as well, with and without these flags. Then I'll prepare the pull request.

meyerj commented 8 years ago

Are you sure it should include the removal of [...] from the two package manifests?

This is a left-over from the rosbuild-to-catkin conversion and can be completely removed. There is no need to add compiler or linker flags to the package manifest because the cmake config generated by catkin will take care of all that, even if the package will be used by a rosbuild dependent.

spmaniato commented 8 years ago

Roger. I'll soon push improvements to the PR #6