Can't build with roslaunch as a dependency
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 ...