Ask Your Question
0

How to fix colcon build fail?

asked 2019-12-04 09:47:27 -0600

Py_J gravatar image

Hi all,

I am trying to follow this tutorial https://index.ros.org/doc/ros2/Tutori... for ROS 2.0 Eloquent on Mac OS Catalina. This fails after entering the colcon build --symlink-install command and I get this error message:

user@users-MBP ros2_example_ws % sudo colcon build --symlink-install
Password:
Starting >>> examples_rclcpp_minimal_action_client
Starting >>> examples_rclcpp_minimal_action_server
Starting >>> examples_rclcpp_minimal_client
Starting >>> examples_rclcpp_minimal_composition
--- stderr: examples_rclcpp_minimal_action_server
Traceback (most recent call last):
  File "/Users/user/ros2_eloquent/ros2-osx/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 /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(/usr/local/bin/python3
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  /Users/user/Desktop/ros2_example_ws/build/examples_rclcpp_minimal_action_server/ament_cmake_package_templates/templates.cmake)
  returned error code 1
Call Stack (most recent call first):
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:38 (include)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmakeConfig.cmake:38 (include)
  CMakeLists.txt:13 (find_package)


---
Failed   <<< examples_rclcpp_minimal_action_server  [ Exited with code 1 ]
--- stderr: examples_rclcpp_minimal_action_client
Traceback (most recent call last):
  File "/Users/user/ros2_eloquent/ros2-osx/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 /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(/usr/local/bin/python3
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  /Users/user/Desktop/ros2_example_ws/build/examples_rclcpp_minimal_action_client/ament_cmake_package_templates/templates.cmake)
  returned error code 1
Call Stack (most recent call first):
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:38 (include)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmakeConfig.cmake:38 (include)
  CMakeLists.txt:13 (find_package)


---
Aborted  <<< examples_rclcpp_minimal_action_client
--- stderr: examples_rclcpp_minimal_composition
Traceback (most recent call last):
  File "/Users/user/ros2_eloquent/ros2-osx/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 /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(/usr/local/bin/python3
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  /Users/user/Desktop/ros2_example_ws/build/examples_rclcpp_minimal_composition/ament_cmake_package_templates/templates.cmake)
  returned error code 1
Call Stack (most recent call first):
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:38 (include)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake/cmake/ament_cmakeConfig.cmake:38 (include)
  CMakeLists.txt:13 (find_package)


---
Aborted  <<< examples_rclcpp_minimal_composition
--- stderr: examples_rclcpp_minimal_client
Traceback (most recent call last):
  File "/Users/user/ros2_eloquent/ros2-osx/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 /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(/usr/local/bin/python3
  /Users/user/ros2_eloquent/ros2-osx/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py


    /Users/user/Desktop/ros2_example_ws/build/examples_rclcpp_minimal_client/ament_cmake_package_templates/templates.cmake)
      returned error code 1
    Call Stack ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-12-04 09:54:16 -0600

marguedas gravatar image

May not qualify as an answer but these errors usually happen when the environment is not set up properly.

Did you follow the previous steps of the tutorial? Especially the "Source an underlay" section, if you install eloquent from binaries it should look similar to https://index.ros.org/doc/ros2/Instal...

Also it is surprising that you have to run colcon with sudo. Does it fail differently if you build without sudo?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-12-04 09:47:27 -0600

Seen: 9 times

Last updated: yesterday