How to fix ROS error: missing rosunitConfig.cmake

Problem

When trying to build some ROS package using colcon build, you see an error message such as

catkinConfig.cmake
CMake Error at /home/uli/dev/Versatile/catkin/install/catkin/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "rosunit" with any
  of the following names:

    rosunitConfig.cmake
    rosunit-config.cmake

  Add the installation prefix of "rosunit" to CMAKE_PREFIX_PATH or set
  "rosunit_DIR" to a directory containing one of the above files.  If
  "rosunit" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)
```plaintext {filename="CMakeLists.txt"}

## Solution

rosunit is currently not available as apt package for ROS jazzy.

Therefore, clone the repo, build it using `colcon` and then `source install/setup.bash` before building your package.

```bash {filename="install_rosunit.sh"}
git clone https://github.com/ros/ros.git
cd ros/tools/rosunit
colcon build
source install/setup.bash
```plaintext {filename="install_rosunit.sh"}

After that (in the same shell), build your other package using `colcon build` again.

Check out similar posts by category: ROS