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

Do I need to install a ros package in order to use its libraries in the same catkinws?

asked 2020-11-20 11:57:28 -0500

rafaelrojas gravatar image

updated 2020-11-21 12:22:17 -0500

lucasw gravatar image

I have a project in a catkin workspace. I'm developing it inside a docker container and this is my only alternative. For this reason I do not want to install any package, as the containers are not persistent.

I have several packages inside the catkin directory and some of then are plugins libraries. I would like to use the libraries of my package A in the package B without installing the package A. I have not been able to do this using the cmake command

find_package(catkin REQUIRED COMPONENTS packageA)


target_link_libraries(package_B_node ${catkin_LIBRARIES})

to add the required includes and the libraries

edit retag flag offensive close merge delete


Can you git clone or otherwise copy the source of package A into the catkin_ws alongside package B?

Or create a new docker image that uses the base docker image you can't alter as a starting point in the Dockerfile and then install package A as the only additional step?

lucasw gravatar image lucasw  ( 2020-11-21 12:26:27 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-11-22 11:36:45 -0500

rafaelrojas gravatar image

Yes I can. The problem is that I forgot the following signature of the catkin_package command in the CMakeLists.txt of the packageA

catkin_package(INCLUDE_DIRS include LIBRARIES plugin_triangle polygons)

without these arguments incatkin_package catkin did not generate the right information in catking_workspace/devel/share/packageA/cmake/packageAConfig.cmake in order to expose the address of the headers and the libraries in the ${catkin_INCLUDE_DIRS} and ${catkin_LIBRARIES} inside the CMakeList.txt of packageB once the find_package function is called.

edit flag offensive delete link more

answered 2020-11-21 12:25:37 -0500

Tahir M. gravatar image

updated 2020-11-21 12:26:21 -0500

For inter-package dependencies inside a catkin workspace, you need to follow two steps:

  • Include your package in find_package in CMakeLists.txt

find_package(catkin REQUIRED COMPONENTS packageA)

  • Add dependencies both build and execute dependencies in your `package.xml <build_depend>packageA</build_depend> <exec_depend>packageA</exec_depend>
edit flag offensive delete link more

Question Tools



Asked: 2020-11-20 11:57:28 -0500

Seen: 240 times

Last updated: Nov 22 '20