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

nav2_util - no such file or directory tf2_geometry_msgs

asked 2022-02-14 07:35:44 -0600

ljaniec gravatar image

updated 2022-02-14 07:39:12 -0600


I have observed during building the Navigation2 from source on new PC (with ROS Galactic, Ubuntu 20.04) that the nav2_util package won't build correctly:

Finished <<< nav2_simple_commander [0.69s]
--- stderr: nav2_util
In file included from /home/piotr/nav2_ws/src/navigation2/nav2_util/src/costmap.cpp:19:
/home/piotr/nav2_ws/src/navigation2/nav2_util/include/nav2_util/geometry_utils.hpp:24:10: fatal error: tf2_geometry_msgs/tf2_geometry_msgs.hpp: No such file or directory
24 | #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/nav2_util_core.dir/build.make:76: src/CMakeFiles/nav2_util_core.dir/costmap.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:212: src/CMakeFiles/nav2_util_core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:146: all] Error 2
Failed <<< nav2_util [8.28s, exited with code 2]Summary: 6 packages finished [31.9s]
1 package failed: nav2_util
1 package had stderr output: nav2_util
27 packages not processed

I followed these steps:

mkdir -p ~/nav2_ws/src
cd ~/nav2_ws/src
git clone --branch galactic
cd ~/nav2_ws
rosdep install -y -r -q --from-paths src --ignore-src --rosdistro galactic
colcon build --symlink-install

It seems only after installing additionally (next to rosdep):

sudo apt-get install ros-galactic-nav-2d-msgs ros-galactic-nav-msgs

Nav2 packages can build correctly.

I have searched a bit after this problem but I didn't find this as a solution suggestion. I am not sure it is even the correct approach too...

What could be the source of this problem? Any suggestions/better fixes/explanations are welcome.


Łukasz Janiec

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-02-14 11:30:50 -0600

I'm not exactly sure why you're seeing that. I might recommend try a new terminal, sourcing /opt/ros/galactic/setup.bash and rebuilding after deleting your install / build spaces in case there's some odd caching going on.

I just cloned the galactic branch in my /tmp directory and confirmed that nav2_util is building fine and the binaries are also tuning over in CI.

edit flag offensive delete link more


It must have been this odd thing with cache because I can't reproduce it now with rebuilding everything again (even after removing ros-galactic-nav-2d-msgs, ros-galactic-nav-msgs) and sourcing everything by hand in known sequence. At least Google will lead people with the same (rare?) problem to this question.

ljaniec gravatar image ljaniec  ( 2022-02-14 14:10:45 -0600 )edit

Question Tools

1 follower


Asked: 2022-02-14 07:35:44 -0600

Seen: 746 times

Last updated: Feb 14 '22