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

how to tell roslaunch to use the shared libraries from my catkin work space lib directory before the default ros libraries.

asked 2014-05-26 10:15:28 -0500

sd gravatar image

I'm debugging my node written in cpp. My code calls ControllerManager::update from controller_manager package. But the gdb doesn't step into the function. I cloned https://github.com/ros-controls/ros_c... and rebuilt it. My node is linked against libcontroller_manager.so built with the controller_manager package. Probably roslaunch loads the version of the libcontroller_manager.so from /opt/ros/hydro/lib instead of the one which was built with the controller_manager package. So the question is how to tell roslaunch to use the shared libraries from my catkin work space lib directory before the default ros libraries.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-05-26 10:38:35 -0500

ahendrix gravatar image

If you source the workspace containing your modified controller_manager package, it should prefer your modified version over the system version.

You can verify that it's set up properly by inspecting the LD_LIBRARY_PATH variable, and running ldd on your node to see the exact paths of the dynamic libraries that it's using.

If something isn't right, DON'T MODIFY LD_LIBRARY_PATH directly; instead, check to make sure that you've built and sourced your catkin workspace properly.

The reason that you shouldn't modify LD_LIBRARY_PATH is because it's only one of the many variables that are set by the setup scripts, and if isn't set correctly, chances are the other environment variables aren't set correctly either. Sorting out your workspace and which setup file to use will be a far more robust solution.

edit flag offensive delete link more

Comments

It turned out that LD_LIBRARY_PATH did include the path to catkin workspace lib directory, but libcontroller_manager.so built there didn't include symbol files. One way to to enable the debug info is probably to add set (CMAKE_CXX_FLAGS "-g") in the CMakeLists.txt . But isn't there an easier way to built all packages in the catkin work space with the debug symbol info?

sd gravatar image sd  ( 2014-05-26 11:25:34 -0500 )edit

Yes; you can set the cmake build type by running catkin_make with -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=RelWithDebInfo

ahendrix gravatar image ahendrix  ( 2014-05-26 11:34:53 -0500 )edit

It worked. Greatly appreciated.

sd gravatar image sd  ( 2014-05-26 12:05:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-05-26 10:15:28 -0500

Seen: 2,420 times

Last updated: May 26 '14