jkaniuka/magician_ros2

Unable to build the packages

Closed this issue ยท 6 comments

Hi, I'm trying to build the mgacician package, however the colcon build fails for dobot_msgs:

sudo colcon build
Starting >>> dobot_msgs
Starting >>> dobot_bringup
Starting >>> dobot_control_panel
Starting >>> dobot_description                                                                            
Starting >>> dobot_driver
Starting >>> dobot_visualization_tools                                                                                                                     
Finished <<< dobot_description [1.62s]                                                                                                                                                              
--- stderr: dobot_msgs                                                                                                                                                               
Traceback (most recent call last):
  File "/opt/ros/humble/lib/rosidl_typesupport_fastrtps_cpp/rosidl_typesupport_fastrtps_cpp", line 6, in <module>
    from rosidl_typesupport_fastrtps_cpp import generate_cpp
ModuleNotFoundError: No module named 'rosidl_typesupport_fastrtps_cpp'
Traceback (most recent call last):
  File "/opt/ros/humble/lib/rosidl_typesupport_fastrtps_c/rosidl_typesupport_fastrtps_c", line 7, in <module>
    from rosidl_typesupport_fastrtps_c import generate_typesupport_fastrtps_c
ModuleNotFoundError: No module named 'rosidl_typesupport_fastrtps_c'
Traceback (most recent call last):
  File "/opt/ros/humble/lib/rosidl_typesupport_introspection_cpp/rosidl_typesupport_introspection_cpp", line 6, in <module>
    from rosidl_typesupport_introspection_cpp import generate_cpp
ModuleNotFoundError: No module named 'rosidl_typesupport_introspection_cpp'
gmake[2]: *** [CMakeFiles/dobot_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:154: rosidl_typesupport_fastrtps_cpp/dobot_msgs/action/detail/dds_fastrtps/point_to_point__type_support.cpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:342: CMakeFiles/dobot_msgs__rosidl_typesupport_fastrtps_cpp.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "/opt/ros/humble/lib/rosidl_typesupport_c/rosidl_typesupport_c", line 6, in <module>
    from rosidl_typesupport_c import generate_c
ModuleNotFoundError: No module named 'rosidl_typesupport_c'
Traceback (most recent call last):
  File "/opt/ros/humble/lib/rosidl_typesupport_introspection_c/rosidl_typesupport_introspection_c", line 6, in <module>
    from rosidl_typesupport_introspection_c import generate_c
ModuleNotFoundError: No module named 'rosidl_typesupport_introspection_c'
gmake[2]: *** [CMakeFiles/dobot_msgs__rosidl_typesupport_fastrtps_c.dir/build.make:154: rosidl_typesupport_fastrtps_c/dobot_msgs/action/detail/point_to_point__rosidl_typesupport_fastrtps_c.h] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:238: CMakeFiles/dobot_msgs__rosidl_typesupport_fastrtps_c.dir/all] Error 2
gmake[2]: *** [CMakeFiles/dobot_msgs__rosidl_typesupport_introspection_cpp.dir/build.make:154: rosidl_typesupport_introspection_cpp/dobot_msgs/action/detail/point_to_point__rosidl_typesupport_introspection_cpp.hpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:368: CMakeFiles/dobot_msgs__rosidl_typesupport_introspection_cpp.dir/all] Error 2
gmake[2]: *** [CMakeFiles/dobot_msgs__rosidl_typesupport_c.dir/build.make:152: rosidl_typesupport_c/dobot_msgs/action/point_to_point__type_support.cpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:290: CMakeFiles/dobot_msgs__rosidl_typesupport_c.dir/all] Error 2
gmake[2]: *** [CMakeFiles/dobot_msgs__rosidl_typesupport_introspection_c.dir/build.make:154: rosidl_typesupport_introspection_c/dobot_msgs/action/detail/point_to_point__rosidl_typesupport_introspection_c.h] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:264: CMakeFiles/dobot_msgs__rosidl_typesupport_introspection_c.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< dobot_msgs [1.83s, exited with code 2]
Aborted  <<< dobot_driver [1.66s]
Aborted  <<< dobot_bringup [2.00s]                                                                                                  
Aborted  <<< dobot_control_panel [1.99s]
Aborted  <<< dobot_visualization_tools [1.91s]
                                 
Summary: 1 package finished [3.10s]
  1 package failed: dobot_msgs
  4 packages aborted: dobot_bringup dobot_control_panel dobot_driver dobot_visualization_tools
  1 package had stderr output: dobot_msgs
  7 packages not processed

Running Ubuntu 22.04 with ROS2 Humble installed...

Any idea's?

Hi @paddenstoeltje, you should create a clean workspace and build packages once again - this time without sudo.
Let me know, if it resolves the problem ๐Ÿ˜‰

Hi thanks,

that worked. However I'm facing another problem now regarding CMAKE. It seems there is something wrong with my environment (although is is sourced):

--- stderr: dobot_msgs                         
Traceback (most recent call last):
  File "/opt/ros/humble/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 21, in <module>
    from ament_package.templates import get_environment_hook_template_path
ModuleNotFoundError: No module named 'ament_package'
CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(/usr/bin/python3.10
  /opt/ros/humble/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  /home/wouter/magician_ros2_control_system_ws/build/dobot_msgs/ament_cmake_package_templates/templates.cmake)
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
  /opt/ros/humble/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:4 (find_package)
  /opt/ros/humble/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
  CMakeLists.txt:22 (find_package)

When looking up: printenv | grep -i ROS I get:
ROS_VERSION=2
ROS_PYTHON_VERSION=3
PWD=/home/wouter/magician_ros2_control_system_ws
AMENT_PREFIX_PATH=/opt/ros/humble
COLCON_PREFIX_PATH=/home/wouter/magician_ros2_control_system_ws/install
PYTHONPATH=/opt/ros/humble/lib/python3.10/site-packages:/opt/ros/humble/local/lib/python3.10/dist-packages:/usr/lib/python3/dist-packages/:/opt/ros/humble/lib/python3.10/site-packages
LD_LIBRARY_PATH=/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib
ROS_LOCALHOST_ONLY=0
PATH=/opt/ros/humble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
ROS_DISTRO=humble
OLDPWD=/home/wouter/magician_ros2_control_system_ws/src

I would try installing ament_package first.
sudo apt install ros-humble-ament-package

It is already installed. Still getting the error. No clue what is wrong.

dobot_msgs is just a package with custom msg, srv and action files. Check if you can build a package from Creating custom msg and srv files tutorial ๐Ÿ˜‰

Reinstalling Ros2 resolved all the problems. Thanks anyway. It seems something was wrong with the environment.