CMake error while building rmf packages. (#660)

Posted by @akshay-ka:

Hello,

I have installed Ubuntu 24.04 on my machine and using ros jazzy version.

For some reasons, I had to clean the rmf_ws to build cleanly.

Now all of a sudden, i get CMake error while i run the colcon build.

Not sure what is the root cause for the issue.

Below is the screenshot of the error.

Could anyone provide guidance or clarification for this problem ?


Edited by @akshay-ka at 2025-04-07T11:15:59Z

Posted by @aaronchongth:

My guess is that, you sourced the workspace, deleted the build, install, log directories, and tried to rebuild it again. Try using a fresh terminal.

When a workspace is sourced, the paths to your built binaries are added to various environment variables (for example PATH and CMAKE_MODULE_PATH), which allows ROS 2 to find binaries or libraries to build with. In your case, one of the packages that are being built is trying to reference a package that has not been built yet (but exists in the environment variable).

When building a workspace, try to only source /opt/ros/jazzy/setup.bash and not other workspaces (unless they are meant to be underlay workspaces). In the future, for build or setup errors, make sure to try on fresh terminals, or even in docker images to verify that it is a personal setup issue rather than a problem upstream.


Edited by @aaronchongth at 2025-04-08T03:21:07Z