Ask Your Question
0

simple navigation goals fails compile, boost link error

asked 2013-01-27 11:07:00 -0500

dan gravatar image

updated 2014-01-28 17:15:00 -0500

ngrennan gravatar image

Using Ubuntu 12.04, Fuerte, I am following the tutorial to develop simple goals: SendingSimpleGoals

However, the code from the page fails to link, with this message:

Linking CXX executable ../bin/simple_navigation_goals /usr/bin/ld: CMakeFiles/simple_navigation_goals.dir/src/simple_navigation_goals.o: undefined reference to symbol 'vtable for boost::detail::thread_data_base' /usr/bin/ld: note: 'vtable for boost::detail::thread_data_base' is defined in DSO /usr/lib/libboost_thread.so.1.46.1 so try adding it to the linker command line /usr/lib/libboost_thread.so.1.46.1: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[3]: * [../bin/simple_navigation_goals] Error 1

I assume I need to list that libboost thread for linking with CMakelists.txt. The file /usr/lib/libboost_thread.so.1.46.1 does exist in the file system.

So, in CMakelists.txt, I uncommented: rosbuild_add_boost_directories()

and uncommented the rosbuild_link_boost line, as follows:

rosbuild_link_boost(simple_navigation_goals /usr/lib/libboost_thread.so.1.46.1)

but that just generates an error that the library /usr/lib/libboost_thread.so.1.46.1 is not found:

rosboost_cfg.rosboost_cfg.BoostError: "Could not locate library [/usr/lib/libboost_thread.so.1.46.1], version (1, 46, 1, '/usr', '/usr/include', True, True) in lib directory [/usr/lib]"

Help would be very much appreciated-- thanks.

edit retag flag offensive close merge delete

Comments

@dan did you manage to make the tutorial work? ive having trouble cancelling a goal any idea hos to accomplish this? thanks

ctguell gravatar image ctguell  ( 2013-11-05 08:09:10 -0500 )edit

Yes, I did get the tutorial to work with jbarry's answer. There is cancel_goal() in move_base action client For example: self.move_base.cancel_goal()

dan gravatar image dan  ( 2013-11-30 11:42:42 -0500 )edit

@dan thanks i made it work, i have one more question is there a simple way to know where the robot it located in a certain time? right now i need the robot to get to (x,y) but at a certain time i need to make the robot stop wait and then send him towards the goal again, but as the robot moved the new goal i have to send depends on how far he moved before stoping, how can i acomplish this?

ctguell gravatar image ctguell  ( 2013-12-02 05:37:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-01-27 12:02:29 -0500

jbarry gravatar image

updated 2013-01-27 12:13:49 -0500

You are right that you need to link boost. However, I think you did not do so quite correctly. You don't actually need to specify the boost distribution and you also want the rosbuild_link_boost line after the rosbuild_add_executable line. It should look like:

rosbuild_add_boost_directories()
rosbuild_add_executable(simple_navigation_goals src/simple_navigation_goals.cpp)
rosbuild_link_boost(${PROJECT_NAME} thread)

Here is my entire CMakeLists.txt file. I saw the same error as you did without linking boost, but was able to compile the example with this file:

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
rosbuild_add_boost_directories()
rosbuild_add_executable(simple_navigation_goals src/simple_navigation_goals.cpp)
rosbuild_link_boost(${PROJECT_NAME} thread)
#target_link_libraries(example ${PROJECT_NAME})
edit flag offensive delete link more

Comments

Thanks for your excellent answer. This fixed the problem. Is there documentation saying that the rosbuild_link_boost line goes after the rosbuild_add_executable line? In the default CMakelists.txt it is listed above the rosbuild_add_executable line, but sure enough, the make fails with that.

dan gravatar image dan  ( 2013-01-27 17:11:47 -0500 )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: 2013-01-27 11:07:00 -0500

Seen: 717 times

Last updated: Jan 27 '13