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

Can we change the order of package compilation in catkin_make command?

asked 2018-09-11 07:30:07 -0500

rama_bhuyan gravatar image

updated 2018-09-11 12:40:31 -0500

jayess gravatar image

$ catkin_make compiles all the ros packages available inside the catkin_ws. so, do we have any provision to change the order of the packages to be compiled.

with example:

catkin_ws:

       /package_1
       /package_2
       /package_3: dependent on package_1 and package_2

if I want to compile all packages with

$ catkin_make

, I don't have control over which package should compile 1st. I want it to be compiled as above order.

So , do we have any provision for reordering the compilation of packages with catkin_make. or should I go with .sh file having individual compilation command?

edit retag flag offensive close merge delete

Comments

2

Well, this should be done automatically when you specify the dependencies in your CMakeLists.txt correctly...

mgruhler gravatar image mgruhler  ( 2018-09-11 08:03:16 -0500 )edit

I second @mgruhler the correct method is to specify the package dependencies in your CMakeLists file then catkin_make will automatically build things in the right order.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-09-11 08:21:38 -0500 )edit

@mgruhler , would you please explaion what changes I need to make in the CMakeLists.txt of /package_3 . I have done: package_3/CMakeLists.txt/ find_package( package_1,package_2)

what else things need to be added ?

rama_bhuyan gravatar image rama_bhuyan  ( 2018-09-11 23:34:32 -0500 )edit

see the answer by @Dirk Thomas and the link to the docs therein. Basically, for every target (which is found in the calls add_library(TARGET ..) and add_executable(TARGET ..)) you need the respective add_dependencies(TARGET ${catkin_EXPORTED_TARGETS}) calls.

mgruhler gravatar image mgruhler  ( 2018-09-12 00:58:44 -0500 )edit

I have done all necessary changes but still I could not arrange the projects. after $catkin_make , the packages are arranged as /package_3 then /package_2, /package_1. @mgruhler

rama_bhuyan gravatar image rama_bhuyan  ( 2018-09-14 00:10:26 -0500 )edit

the error I am getting is: Could not find configuration file provided by "/package_1" with any of the following name package_1Config.cmake package_1-Config.cmake

rama_bhuyan gravatar image rama_bhuyan  ( 2018-09-14 00:12:49 -0500 )edit
1

You might want to share the exact content of your packages otherwise there is too much guessing involved.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-09-14 00:26:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-09-11 10:45:04 -0500

Dirk Thomas gravatar image

catkin_make builds all packages in a workspace within the same CMake context. So there is no "order" between packages.

To make sure your packages still compile correctly with catkin_make you have to make sure to also specify cross-package target dependencies (e.g. using the "EXPORTED_TARGETS" mentioned in the docs).

If you actually want to build the packages in separate CMake invocations (which will avoid the need for cross-package target dependencies) you can use either of the following build tools: catkin_make_isolated (recommended for ROS 1), catkin_tools (not recommended but very powerful and used by many people already), colcon (developed for ROS 2 and should work for ROS 1 too, very young so not as robust as the other ones yet).

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-09-11 07:30:07 -0500

Seen: 1,277 times

Last updated: Sep 11 '18