Ask Your Question
0

undefined reference to symbol 'vtable for boost::detail::thread_data_base'

asked 2012-12-09 12:40:52 -0600

آمال gravatar image

updated 2014-01-28 17:14:31 -0600

ngrennan gravatar image

hi all,

I am trying to build macros to add executable. I create my package and add this rosbuild_add_executable(mytele_keyboard src/turtlebot_key.cpp) in CMakeLists.txt

then When do rosmake my package I get 1 failure !! I am now try to understand what is wrong


amal@amal-HP-G62-Notebook-PC:/opt/ros/fuerte/stacks/turtlebot_apps/turtlebot_teleop/src$ rosmake mytele
[ rosmake ] rosmake starting...                                                                          
[ rosmake ] Packages requested are: ['mytele']                                                           
[ rosmake ] Logging to directory /home/amal/.ros/rosmake/rosmake_output-20121210-031624                  
[ rosmake ] Expanded args ['mytele'] to:
['mytele']                                                      
[rosmake-0] Starting >>> geometry_msgs [ make ]                                                          
[rosmake-1] Starting >>> roslang [ make ]                                                                
[rosmake-0] Finished <<< geometry_msgs  No Makefile in package geometry_msgs                             
[rosmake-1] Finished <<< roslang  No Makefile in package roslang                                         
[rosmake-1] Starting >>> rospy [ make ]                                                                  
[rosmake-3] Starting >>> roscpp [ make ]                                                                 
[rosmake-1] Finished <<< rospy  No Makefile in package rospy                                             
[rosmake-3] Finished <<< roscpp  No Makefile in package roscpp                                           
[rosmake-3] Starting >>> mytele [ make ]                                                                 
[ rosmake ] Last 40 linestele: 0.8 sec ]                                        [ 1 Active 4/5 Complete ]
{-------------------------------------------------------------------------------
  mkdir -p bin
  cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake  ..
  [rosbuild] Building package mytele
  [rosbuild] Including /opt/ros/fuerte/share/roscpp/rosbuild/roscpp.cmake
  [rosbuild] Including /opt/ros/fuerte/share/rospy/rosbuild/rospy.cmake
  [rosbuild] Including /opt/ros/fuerte/stacks/client_rosjava_jni/rosjava_jni/cmake/rosjava.cmake
  [rosbuild] Including /opt/ros/fuerte/share/roslisp/rosbuild/roslisp.cmake
  -- Configuring done
  -- Generating done
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_TOOLCHAIN_FILE


  -- Build files have been written to: /home/amal/ros/sandbox/turtlebot_sim/mytele/build
  cd build && make -l4
  make[1]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[2]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[3]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[3]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  [  0%] Built target rospack_genmsg_libexe
  make[3]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[3]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  [  0%] Built target rosbuild_precompile
  make[3]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[3]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[3]: Entering directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  Linking CXX executable ../bin/mytele_keyboard
  /usr/bin/ld: CMakeFiles/mytele_keyboard.dir/src/turtlebot_key.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/mytele_keyboard] Error 1
  make[3]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[2]: *** [CMakeFiles/mytele_keyboard.dir/all] Error 2
  make[2]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
  make[1]: *** [all] Error 2
  make[1]: Leaving directory `/home/amal/ros/sandbox/turtlebot_sim/mytele/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package mytele written to:
[ rosmake ]    /home/amal/.ros/rosmake/rosmake_output-20121210-031624/mytele/build_output.log
[rosmake-3] Finished <<< mytele [FAIL] [ 0.89 seconds ]                                                  
[ rosmake ] Halting due to failure in package mytele. 
[ rosmake ] Waiting for other ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2012-12-09 13:07:02 -0600

moyashi gravatar image

updated 2012-12-10 13:45:12 -0600

Did you check your typing error?
eg. "turtlebot_key.cpp -> turtlebot_key-cpp"

Edit 1.
If it has some kind of trouble with boost libraries as Mr. Peris pointed out(Thank you!),
CMakeLists.txt shall be ...

rosbuild_add_boost_directories()
rosbuild_add_executable(mytele_keyboard src/turtlebot_key.cpp)
rosbuild_link_boost(mytele_keyboard thread)

Please be careful, rosbuild_add_executable(...) should come before rosbuild_link_boost(...).
This will help you -> http://www.ros.org/wiki/rosbuild/CMakeLists/Examples#Using_Boost

edit flag offensive delete link more

Comments

sorry that is just when typing here but I write it "turtlebot_key.cpp" and does not work

آمال gravatar imageآمال ( 2012-12-09 13:08:46 -0600 )edit

I open turtlebot_key.cpp and I do not find executable called "mytele_keyboard" ?!

آمال gravatar imageآمال ( 2012-12-09 13:10:55 -0600 )edit

I do this now, but still not work... please see my edit 2 again

Thanks

آمال gravatar imageآمال ( 2012-12-13 05:31:31 -0600 )edit
1

in rosbuild_link_boost(${PROJECT_NAME} thread) it looks like ${PROJECT_NAME} will resolve to mytele since that's the name of the overall project. You want it to resolve to mytele_keyboard like @moyashi said. Try replacing what you have with rosbuild_link_boost(mytele_keyboard thread)

tbh gravatar imagetbh ( 2012-12-13 05:55:22 -0600 )edit

Thanks It work now, and sorry

آمال gravatar imageآمال ( 2012-12-13 06:06:05 -0600 )edit
5

answered 2012-12-09 16:51:28 -0600

Looks like some kind of trouble with boost libraries.

Have you added this two lines to your CMakeLists.txt?

rosbuild_add_boost_directories()
rosbuild_link_boost(${PROJECT_NAME} thread)
edit flag offensive delete link more

Comments

see edit 2 that is my CMakLists.txt

Thanks

آمال gravatar imageآمال ( 2012-12-09 17:25:48 -0600 )edit
1

Try to uncomment the two lines that I mentioned before :)

Martin Peris gravatar imageMartin Peris ( 2012-12-09 18:09:09 -0600 )edit

I do but not work ..

Thanks

آمال gravatar imageآمال ( 2012-12-13 05:37:08 -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-12-09 12:40:52 -0600

Seen: 1,656 times

Last updated: Dec 13 '12