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

Adding dependencies to a package

asked 2021-04-23 13:44:59 -0500

sisko gravatar image

updated 2021-04-23 14:37:53 -0500

Does the catkin_make process automatically download packages identified as dependencies ???

I have a package which makes use of the rosbridge package.

I defined the find_package section of my CMakeLists.txt like so :

find_package(catkin REQUIRED COMPONENTS
  rosbridge_server
  rospy
)

And I added the following lines to my package.xml :

  <build_export_depend>rosbridge_server</build_export_depend>
  <exec_depend>rosbridge_server</exec_depend>

However, I get the following when I execute catkin_make :

.
.
.
-- Could NOT find rosbridge_server (missing: rosbridge_server_DIR)
-- Could not find the required component 'rosbridge_server'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "rosbridge_server"
  with any of the following names:

    rosbridge_serverConfig.cmake
    rosbridge_server-config.cmake

  Add the installation prefix of "rosbridge_server" to CMAKE_PREFIX_PATH or
  set "rosbridge_server_DIR" to a directory containing one of the above
  files.  If "rosbridge_server" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  sweepbot/Sweeper/sweepbot_test2/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/sisko/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/sisko/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

I found this question but it's answer is out of date.

edit retag flag offensive close merge delete

Comments

Please do not ask multiple questions in a single post.

That's not how this site works. It's a Q&A site, which works best with a 1-to-1 ratio of questions to answers. Similar to how StackExchange et al. work.

It'd be best if you edit your current question and decide which of your questions you want to keep in this one.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-23 14:19:50 -0500 )edit
1

I would also suggest to see whether #q252478 demystifies the how-to-build-packages-from-sources question.

The fact they are "your own" packages, does not change the workflow (except of course you may not need to git clone them first).

gvdhoorn gravatar image gvdhoorn  ( 2021-04-23 14:24:43 -0500 )edit

Hello @gvdhoom. There seems to be a misunderstanding. My question may have multiple facets to it but they are all related to the same issue of adding dependencies to ros packages. I merely added more information from different perspectives.

sisko gravatar image sisko  ( 2021-04-23 14:24:47 -0500 )edit

Also, when running catkin_create_pkg and adding dependencies as the package is being created, are the dependencies simply the name of the package OR the the correct dependency name found somewhere else ?

this is a different question than "does catkin download dependencies" and should be asked in a separate post.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-23 14:26:25 -0500 )edit

Thank you @gvdboom: The link you provided referred to rosdep which does exactly what I needed and though catkin_make might. If you care to provided your input as an answer, I'll be happy to accept it.

sisko gravatar image sisko  ( 2021-04-23 14:49:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-24 03:05:36 -0500

gvdhoorn gravatar image

updated 2021-04-24 03:06:01 -0500

To give this an answer:

Does the catkin_make process automatically download packages identified as dependencies ???

No.

catkin_make is only responsible for building your workspace, it does not download anything.

In fact, catkin_make does not even directly build your workspace. It relies on tools like CMake to do that.

Catkin's main responsibility is to figure out in which order your packages should be built, as dependencies must be built before dependents.

The tool which is responsible for gathering the dependencies of your ROS packages is rosdep. It reads that information from all the package.xml files (ie: the manifests) in your workspace, computes which dependencies are missing from your workspace (if you specify the --ignore-src option) and then instructs other tools to actually install your dependencies (in most cases: apt and pip).

Summarising: catkin_make does not download nor install dependencies of your packages. rosdep is the tool which is supposed to do that.

See #q215059 for a more in-depth discussion on rosdep, and refer to #q217475 on why you need to duplicate (some of the) dependency information in both package.xml and CMakeLists.txt.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-04-23 13:44:59 -0500

Seen: 1,112 times

Last updated: Apr 24 '21