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

Can't build with roslaunch as a dependency

asked 2021-07-31 23:18:22 -0500

Eric Schneider gravatar image

I've been given a repo with roslaunch as a dependency in the CMake files, and it fails to build like so:

-- Could NOT find roslaunch (missing: roslaunch_DIR)
-- Could not find the required component 'roslaunch'. 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/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "roslaunch" with
  any of the following names:

roslaunchConfig.cmake
roslaunch-config.cmake

So I tried creating a fresh catkin package to see if I can recreate the issue. Even with the fresh catkin package roslaunch is causing catkin_make issues, I'll walk through them here.

Just to confirm at the beginning, roslaunch is installed. The first time I saw the build error below I installed it with sudo apt install python3-roslaunch. If that method of install is the problem that'd be an easy fix, but I think it's okay.

eric@laptop:~/tutorials/catkin_ws$ roslaunch -h
Usage: roslaunch [options] [package] <filename> [arg_name:=value...]
       roslaunch [options] <filename> [<filename>...] [arg_name:=value...]

If <filename> is a single dash ('-'), launch XML is read from standard input.
...

Okay, how to create the issue. I started from the basic ROS build-a-package tutorial like so:

eric@laptop:~/tutorials$ source /opt/ros/noetic/setup.bash
eric@laptop:~/tutorials$ printenv | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/ros/noetic/share
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
eric@laptop:~/tutorials$ mkdir -p catkin_ws/src/
eric@laptop:~/tutorials$ cd catkin_ws/
eric@laptop:~/tutorials/catkin_ws$ ls
src
eric@laptop:~/tutorials/catkin_ws$ catkin_make
Base path: /home/eric/tutorials/catkin_ws
...
#### Running command: "make -j8 -l8" in "/home/eric/tutorials/catkin_ws/build"
eric@laptop:~/tutorials/catkin_ws$ ls
build  devel  src
eric@laptop:~/tutorials/catkin_ws$ source devel/setup.bash
eric@laptop:~/tutorials/catkin_ws$ cd src/

eric@laptop:~/tutorials/catkin_ws/src$ catkin_create_pkg figuring_out_roslaunch_issue roscpp rospy roslaunch std_msgs
Created file figuring_out_roslaunch_issue/package.xml
Created file figuring_out_roslaunch_issue/CMakeLists.txt
Created folder figuring_out_roslaunch_issue/include/figuring_out_roslaunch_issue
Created folder figuring_out_roslaunch_issue/src
Successfully created files in /home/eric/tutorials/catkin_ws/src/figuring_out_roslaunch_issue. Please adjust the values in package.xml.

eric@laptop:~/tutorials/catkin_ws/src$ cd ..
eric@laptop:~/tutorials/catkin_ws$ catkin_make
Base path: /home/eric/tutorials/catkin_ws
Source space: /home/eric/tutorials/catkin_ws/src
Build space: /home/eric/tutorials/catkin_ws/build
Devel space: /home/eric/tutorials/catkin_ws/devel
Install space: /home/eric/tutorials/catkin_ws/install
####
#### Running command: "cmake /home/eric/tutorials/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/eric/tutorials/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/eric/tutorials/catkin_ws/install -G Unix Makefiles" in "/home/eric/tutorials/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/eric/tutorials/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/eric/tutorials/catkin_ws/devel;/opt/ros/noetic
-- This workspace overlays: /home/eric/tutorials/catkin_ws/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2021-08-01 02:31:54 -0500

gvdhoorn gravatar image

updated 2021-08-01 03:01:52 -0500

Just to confirm at the beginning, roslaunch is installed. The first time I saw the build error below I installed it with sudo apt install python3-roslaunch. If that method of install is the problem that'd be an easy fix, but I think it's okay.

No, it's not okay, and this could be the cause of your problems.

python3-roslaunch is not the correct package, but an UpstreamPackage. The correct package would be ros-$ROS_DISTRO-roslaunch. In your case: ros-noetic-roslaunch.

You cannot (and should not) mix these two package sources.

See the linked wiki page for more information, and see “upstream packages” increasingly becoming a problem on ROS Discourse for a meta-discussion about them.

PS: I am surprised though how you could have a ROS Noetic installation without roslaunch, as it's a very low-level dependency.

Seeing as you've already installed (s)one upstream package(s): could you tell us how you've installed ROS? Perhaps you have only a partial install.

edit flag offensive delete link more

Comments

1

And PPS: roslaunch is a Python package. I'm not sure I've ever seen it as a build_depend (well, that's not true, before it could be used as a test_depend it was listed as a build_depend).

gvdhoorn gravatar image gvdhoorn  ( 2021-08-01 02:34:49 -0500 )edit

Love it, super simple fix, thanks! sudo apt remove python3-roslaunch and sudo apt install ros-noetic-roslaunch did indeed fix the problem.

I don't know why roslaunch wasn't already installed, I followed the vanilla ROS install instructions a few weeks ago and installed ros-noetic-desktop-full. My best guess is that I accidentally screwed up the version that is originally installed.

The reason I installed python3-roslaunch is that I was prompted to like so. Maybe I had forgotten to source noetic, saw this, ran it, and messed with the underlying version that way?

eric@laptop:~$ roslaunch
Command 'roslaunch' not found, but can be installed with:
sudo apt install python3-roslaunch
Eric Schneider gravatar image Eric Schneider  ( 2021-08-01 07:23:23 -0500 )edit

As far as I can tell roslaunch is not a build_depend, it's just called with find_package in CMake. I've inherited a repo recently that is trying out this ROS package on github. roslaunch appears in the CMake file but not package.xml.

Eric Schneider gravatar image Eric Schneider  ( 2021-08-01 07:25:09 -0500 )edit

Anything in a find_package(..) is by definition a build_depend.

The fact it isn't actually listed as a build_depend (or a test_depend) is actually "even worse".

gvdhoorn gravatar image gvdhoorn  ( 2021-08-01 09:53:48 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-07-31 23:18:22 -0500

Seen: 404 times

Last updated: Aug 01 '21