Rosanswers logo

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.

Originally posted by dan on ROS Answers with karma: 875 on 2013-01-27

Post score: 0

Original comments

Comment by ctguell on 2013-11-05:
@dan did you manage to make the tutorial work? ive having trouble cancelling a goal any idea hos to accomplish this? thanks

Comment by dan on 2013-11-30:
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()

Comment by ctguell on 2013-12-02:
@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?


1 Answer 1


Rosanswers logo

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_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)

# 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)


#set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services

#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_executable(simple_navigation_goals src/simple_navigation_goals.cpp)
rosbuild_link_boost(${PROJECT_NAME} thread)
#target_link_libraries(example ${PROJECT_NAME})

Originally posted by jbarry with karma: 280 on 2013-01-27

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by dan on 2013-01-27:
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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.