Galactic: 'No rule to make target' for custom messages

asked 2022-07-12 15:56:37 -0600

BlakeAnderson gravatar image

updated 2022-07-15 12:21:38 -0600

This is for Galactic / Ubuntu 20.04.

I'm new to ROS2 and am getting a consistent 'No rule to make target' error when trying to build packages that produce interfaces via the rosidl_generate_interfaces command. Here is an example for the turtlesim package.

--- stderr: turtlesim                               
make[1]: *** No rule to make target 'turtlesim__py/CMakeFiles/turtlesim__py.dir/all', needed by 'CMakeFiles/turtlesim__python.dir/all'.  Stop.
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:146: all] Error 2
---
Failed   <<< turtlesim [5.25s, exited with code 2]

I've dug into the relevant build files to investigate. In turtlesim/CMakeFiles//Makefile I see line 429 where the error is thrown:

CMakeFiles/turtlesim__python.dir/all: turtlesim__py/CMakeFiles/turtlesim__py.dir/all

The error is that the dependency turtlesim__py/CMakeFiles/turtlesim__py.dir/all does not exist. However, I see farther down on line 656 that this target is created:

/home/blake/ros2/build/turtlesim/turtlesim__py/CMakeFiles/turtlesim__py.dir/all

The difference being that the target uses an absolute path when declared, but a path relative to the makefile when called as a dependency. The relative path is not recognized as equivalent to the absolute path.

Can anyone explain the cause of this issue? I expect it must be some kind of environment configuration problem, but my env variables all appear correct per the ROS2 tutorials.

edit retag flag offensive close merge delete

Comments

A possible clue. If I run colcon within the package directory instead of the workspace root, it builds successfully. When I inspect these same lines in the generated makefile, I see that relative paths are used throughout for consistency. The question, then, is why colcon generates targets with absolute paths when it runs in the workspace root.

BlakeAnderson gravatar image BlakeAnderson  ( 2022-07-15 12:21:23 -0600 )edit

I see @sardanian had a similar issue recently, but their question was not resolved: https://answers.ros.org/question/4029...

BlakeAnderson gravatar image BlakeAnderson  ( 2022-07-15 16:23:53 -0600 )edit

I have the exact same issue on Humble / Ubuntu 22.04 with the tutorial_interfaces. Thought it was related to Python 3.10, so I switch to Foxy / Ubuntu 20.04 : same issue... So rosidl_generator is the issue ?!

teuneuns gravatar image teuneuns  ( 2022-07-25 00:48:38 -0600 )edit

Seems to be. I can suppress the error by commenting out that part of the CMakelists.

BlakeAnderson gravatar image BlakeAnderson  ( 2022-07-25 15:17:40 -0600 )edit