ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Some errors occurred when package was compiling.(LINK ERROR)

asked 2017-09-24 22:52:23 -0500

pdmike gravatar image

updated 2018-06-26 03:54:12 -0500

jayess gravatar image

Hey guys, i just copy the codes , in the Chapter 10 of book,' Mastering ROS for Robotics Programming', to my ros. The cmakelists file is written as followed,


cmake_minimum_required(VERSION 2.8.3)
project(seven_dof_arm_test)
find_package(catkin REQUIRED COMPONENTS
  cmake_modules
  interactive_markers
  moveit_core
  moveit_ros_perception
  moveit_ros_planning_interface
  pluginlib**
  roscpp
  std_msgs
)
find_package(Boost REQUIRED COMPONENTS system)
catkin_package(
)
include_directories(
  ${catkin_INCLUDE_DIRS}
)
add_executable(test_random_node src/test_random.cpp)
add_dependencies(test_random_node seven_dof_arm_test_generate_messages_cpp)
target_link_libraries(test_random_node
   ${catkin_LIBRARIES}
 )
include_directories(
  ${catkin_INCLUDE_DIRS}
)

And the cpp file is shown as followed,

#include <moveit/move_group_interface/move_group.h>
int main(int argc, char **argv)
{
  ros::init(argc, argv, "move_group_interface_demo", ros::init_options::AnonymousName);
  // start a ROS spinning thread
  ros::AsyncSpinner spinner(1);
  spinner.start();
  // this connecs to a running instance of the move_group node
  move_group_interface::MoveGroup group("arm");
  // specify that our target will be a random one
  group.setRandomTarget();
  // plan the motion and then move the group to the sampled target 
  group.move();
  ros::waitForShutdown();
}

Now when the package is compiling, the error occured ,

Linking CXX executable /home/aicrobo/catkin_ws/devel/lib/seven_dof_arm_test/test_random_node
/opt/ros/indigo/lib/libmoveit_planning_scene_monitor.so: undefined reference to `ros::WallTimer::setPeriod(ros::WallDuration const&, bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/aicrobo/catkin_ws/devel/lib/seven_dof_arm_test/test_random_node] Error 1
make[1]: *** [seven_dof_arm_test/CMakeFiles/test_random_node.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j1 -l1" failed

So do you have any idea about the problem? Thank you

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-09-29 00:26:58 -0500

pdmike gravatar image

I got the solution in [ https://github.com/ros/ros_comm/issue... ]

edit flag offensive delete link more
1

answered 2017-09-26 00:47:03 -0500

v4hn gravatar image

I fully understand your frustration here and this should "just work" - and usually does so.

I can't see anything wrong with your code this far.

Shots in the dark:

  • Did you add all the packages you find_package as COMPONENTS as <build_depend> in the corresponding package.xml? I found this has an influence on ordering of libraries in the build process and can induce weird linking problems. catkin_lint is your friend here.

  • Are you sure your system is ok? Does it work on a different machine?

edit flag offensive delete link more

Comments

Hey dude, Thank your for your reply. And i am new in the ROS. I just download Moveit by the command, sudo apt-get install ros-indigo-moveit-full. I dont exactly know if the the packages find_package as COMPONENTS as <build_depend> in the corresponding package.xml. <buildtool_depend>catkin</buildtool_depend><build_depend>cmake_modules</build_depend><build_depend>interactive_markers</build_depend><build_depend>moveit_core</build_depend><build_depend>moveit_ros_perception</build_depend><build_depend>moveit_ros_planning_interface</build_depend><build_depend>pluginlib</build_depend><build_depend>roscpp</build_depend><build_depend>std_msgs</build_depend><run_depend>cmake_modules</run_depend><run_depend>interactive_markers</run_depend><run_depend>moveit_core</run_depend><run_depend>moveit_ros_perception</run_depend><run_depend>moveit_ros_planning_interface</run_depend><run_depend>pluginlib</run_depend><run_depend>roscpp</run_depend><run_depend>std_msgs</run_depend> <export></export></package>

pdmike gravatar image pdmike  ( 2017-09-26 01:09:35 -0500 )edit

Hm, if this is part of your corresponding package.xml file, this should be fine too... I'm sorry, I can't see anything wrong with your package at the moment. Are you sure your system (which one?) is actually ok?

v4hn gravatar image v4hn  ( 2017-09-26 01:19:13 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-09-24 22:25:11 -0500

Seen: 434 times

Last updated: Jun 26 '18