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

Failure in building ROS2 Rolling via source

asked 2021-01-22 06:10:55 -0600

NithishkumarS gravatar image

updated 2021-01-22 08:38:58 -0600

gvdhoorn gravatar image

When the colcon starts building tf2 the following error pops up. How does one fix this issue and continue build via source?

 /home/nithish/ros2_rolling/install/geometry_msgs/include/geometry_msgs/msg/detail/vector3__traits.hpp:28:5: error: ‘value_to_yaml’ was not declared in this scope
   28 |     value_to_yaml(msg.x, out);
      |     ^~~~~~~~~~~~~
/home/nithish/ros2_rolling/install/geometry_msgs/include/geometry_msgs/msg/detail/vector3__traits.hpp:38:5: error: ‘value_to_yaml’ was not declared in this scope
   38 |     value_to_yaml(msg.y, out);
      |     ^~~~~~~~~~~~~
edit retag flag offensive close merge delete


In order to best help, we would need to know what steps you took to reach this result and what instructions you were following. Also of potential use would be the output of vcs export --exact src from your workspace to see which exact versions of ROS packages you are trying to build.

nuclearsandwich gravatar image nuclearsandwich  ( 2021-01-22 15:26:45 -0600 )edit

I can't promise this is your specific issue, but I've had that issue before when I tried building in a dirty terminal that had already sourced Foxy binaries. When I nuked that workspace's build/log/install and opened a fresh terminal I got it to work again.

stevemacenski gravatar image stevemacenski  ( 2021-01-22 16:07:53 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-04-07 03:41:46 -0600

m2-farzan gravatar image

If you have already installed a previous version of ROS (like foxy), that might be the source of the problem. It's because value_to_yaml function is introduced recently, and the compiler may prioritize the older version of ROS, resulting the 'not declared' error. To solve this, I just had to comment out source /opt/ros/foxy/setup.bash from my ~/.bashrc file and restart the terminal. Hope this helps.

edit flag offensive delete link more


Thanks a lot, you save my life. And btw, please make sure delete the previous build cache before colcon build again

zzsqwq gravatar image zzsqwq  ( 2022-12-16 02:03:29 -0600 )edit

Question Tools



Asked: 2021-01-22 06:10:55 -0600

Seen: 625 times

Last updated: Jan 22 '21