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

Sudden custom_msgs related error in ros2, build failed in CI.

asked 2022-09-20 17:42:22 -0500

ryohei sasaki gravatar image

updated 2022-09-21 18:26:00 -0500

I branched off a branch where CI was successful in April 2022 and submitted the following Pull Request, but CI failed.
Local build is successful.

The changes made in the commit do not seem to be related to the build error. https://github.com/rsasaki0109/lidars...

The following is the error content at the time of build.

stderr: graph_based_slam
CMake Error at /home/runner/ros2_ws/install/lidarslam_msgs/share/lidarslam_msgs/cmake/ament_cmake_export_targets-extras.cmake:18 (message):
  Failed to find exported target names in
  '/home/runner/ros2_ws/install/lidarslam_msgs/share/lidarslam_msgs/cmake/lidarslam_msgs__rosidl_generator_cExport.cmake'
Call Stack (most recent call first):
  /home/runner/ros2_ws/install/lidarslam_msgs/share/lidarslam_msgs/cmake/lidarslam_msgsConfig.cmake:41 (include)
  CMakeLists.txt:30 (find_package)
Failed   <<< graph_based_slam [1.95s, exited with code 1]

https://github.com/rsasaki0109/lidars...

I used ros2 foxy as an example, but the same error occurred in ros2 humble.
https://github.com/rsasaki0109/lidars...

It looks like a custom message issue, but I'm not sure of the solution after searching the net.
https://github.com/rsasaki0109/lidars...

How can this problem be solved?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-10 00:40:24 -0500

ijnek gravatar image

updated 2022-11-10 07:47:04 -0500

TL;DR: In your Github CI, specify a container as following:

runs-on: ubuntu-20.04  # or ubuntu-latest or ubuntu-22.04
container:
  image: ubuntu:focal  # for Foxy or Galactic, and "ubuntu:jammy" for Humble or Rolling

I got stuck on this one, but found out what the issue was. In your CI, you run everything directly on the Github's action runner (ubuntu-20.04 for Galactic, and ubuntu-22.04 for Humble).

Now, Github runners have CMake versions later than the system dependency's explicitly installed, and as of August 9th 2022, they have upgraded their CMake version to CMake 3.24.0.

You can confirm your CMake Version by adding:

# Print CMAKE_VERSION
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")

to your CMakeLists.txt. If you're using the ubuntu-latest (= ubuntu-20.04) github action runner, you'll see it prints:

CMAKE_VERSION: 3.24.2

CMake 3.24.0 has tweaked its export template, so the regular expression in ament_cmake_export_targets-extra.cmake no longer match. This has been fixed already in ament_cmake #395 for all active distros, but a release hasn't been made for Galactic yet. Regardless of the release being made or not, continue reading to ensure you don't face such issues in the future.

REP2000 defines that the CMake version used to compile ROS packages are the same as the system default - 3.14.3 for Ubuntu 20.04 (Focal) and 3.22.1 for Ubuntu 22.04 (Jammy). So these are the cmake versions you should be using to build your packages.

Easiest way of achieving this, is by running your jobs in a container inside the Github runner, to ensure you don't have other cmake version installed. In your Github CI file (ie. .github/workflows/main.yml), instead of having just:

runs-on: ubuntu-20.04   # or ubuntu-latest or ubuntu-22.04

specify a container as following:

runs-on: ubuntu-20.04   # or ubuntu-latest or ubuntu-22.04
container:
  image: ubuntu:focal   # for Foxy or Galactic, and "ubuntu:jammy" for Humble or Rolling

This ensures you are building your package in a clean ubuntu container, and not on a Github Action runner machine with packages explicitly installed.

edit flag offensive delete link more

Comments

Thank you very much! I had seen the above error when increasing the version of cmake in a local environment, but I could not reach that solution. I built my package!

ryohei sasaki gravatar image ryohei sasaki  ( 2022-12-05 21:51:48 -0500 )edit

Question Tools

Stats

Asked: 2022-09-20 17:42:22 -0500

Seen: 281 times

Last updated: Nov 10 '22