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

Build catkin packages with colcon

asked 2019-03-20 10:26:18 -0600

odelay gravatar image

updated 2019-03-20 11:38:08 -0600

Hello all,

in my ROS2 workspace I want to build two packages which use the catkin build system ( and ). From the colcon documentation I take that it should be able to use catkin as underlying build system. However when I run colcon build on the workspace it throws the error:

user@user-VirtualBox:~/ros2_ws$ colcon build
Starting >>> mrt_cmake_modules
--- stderr: mrt_cmake_modules                          
CMake Error at CMakeLists.txt:4 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:


  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been

Failed   <<< mrt_cmake_modules  [ Exited with code 1 ]

Summary: 0 packages finished [0.63s]
  1 package failed: mrt_cmake_modules
  1 package had stderr output: mrt_cmake_modules
  10 packages not processed

So cmake is apparently not able to "find" catkin. A colcon info correctly identifies the package as type: ros.catkin. If I do a catkin build in a separate catkin workspace it works. I am using Ubuntu 18.04 with both ros-melodic and ros-crystal installed from the ROS repositories. As requested, some further version information:

user@user-VirtualBox:~/ros2_ws$ colcon version-check
colcon-argcomplete 0.3.2: up-to-date
colcon-bash 0.3.2: up-to-date
colcon-cmake 0.2.8: up-to-date
colcon-core 0.3.18: newer version available (0.3.19)
colcon-defaults 0.2.1: up-to-date
colcon-devtools 0.2.1: up-to-date
colcon-library-path 0.2.1: up-to-date
colcon-metadata 0.2.1: up-to-date
colcon-notification 0.2.6: newer version available (0.2.7)
colcon-output 0.2.3: up-to-date
colcon-package-information 0.2.2: up-to-date
colcon-package-selection 0.2.3: newer version available (0.2.4)
colcon-parallel-executor 0.2.3: up-to-date
colcon-pkg-config 0.1.0: up-to-date
colcon-powershell 0.3.4: up-to-date
colcon-python-setup-py 0.2.1: up-to-date
colcon-recursive-crawl 0.2.0: up-to-date
colcon-ros 0.3.8: up-to-date
colcon-test-result 0.3.1: up-to-date
colcon-zsh 0.3.2: up-to-date

I would be thankful if you could point me in the right direction here.

edit retag flag offensive close merge delete


Please provide more information, e.g. the full output of the invocation (this posted snippet is unlikely to be all), the output of colcon version-check.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-03-20 10:56:22 -0600 )edit

I added the requested info. For now I do not know how I can upgrade the colcon packages to a newer version independent of the deb package repositories.

odelay gravatar image odelay  ( 2019-03-20 11:43:47 -0600 )edit

The latest versions are available via Debian packages. So the usual sudo apt update && sudo apt dist-upgrade should get them.

What do the following commands output: env | grep CMAKE_PREFIX_PATH (in the terminal where you invoked colcon build) and colcon info mrt_cmake_modules?

Dirk Thomas gravatar image Dirk Thomas  ( 2019-03-20 12:34:50 -0600 )edit

Okay, my packages are already up-to-date with the repositories. The CMAKE_PREFIX_PATH variable is not found (this should probably not be the case..). The last command returns:

user@user-VirtualBox:~/ros2_ws$ colcon info mrt_cmake_modules
path: /home/christian/ros2_ws/src/mrt_cmake_modules
  type: ros.catkin
  name: mrt_cmake_modules
    build: catkin coverage rospack
odelay gravatar image odelay  ( 2019-03-20 13:48:23 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-20 13:51:37 -0600

Dirk Thomas gravatar image

catkin can't be found because your CMAKE_PREFIX_PATH is empty. The likely reason is that you haven't sourced the setup file: . /opr/ros/melodic/setup.bash

edit flag offensive delete link more


Maybe this needs to be added to the Colcon Tutorial ( ) since this mixing of ROS distributions is not entirely obvious for a ROS2 beginner.

odelay gravatar image odelay  ( 2019-03-21 04:53:28 -0600 )edit

I don't see how this related to mixing ROS distributions. You are using ROS 1 Melodic and build a catkin package on top of it.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-03-21 10:03:46 -0600 )edit

Question Tools



Asked: 2019-03-20 10:26:18 -0600

Seen: 6,773 times

Last updated: Mar 20 '19