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

ROS2 - Cannot build examples

asked 2023-07-27 12:14:45 -0600

phil123456 gravatar image

Hi,

I am trying to build the examples from the tutorials

I did precisely this

mkdir -p ros2_ws/src
cd ros2_ws
git clone https://github.com/ros2/examples src/examples -b foxy
cd src
colcon build --symlink-install

I get this

pi@ros-pi:~/WORK/ros2_ws$ colcon build --symlink-install
Starting >>> examples_rclcpp_async_client
Starting >>> examples_rclcpp_cbg_executor
Starting >>> examples_rclcpp_minimal_action_client
Starting >>> examples_rclcpp_minimal_action_server                                                                
--- stderr: examples_rclcpp_minimal_action_client                                                                             
CMake Error at CMakeLists.txt:14 (find_package):
  By not providing "Findexample_interfaces.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "example_interfaces", but CMake did not find one.

  Could not find a package configuration file provided by
  "example_interfaces" with any of the following names:

    example_interfacesConfig.cmake
    example_interfaces-config.cmake

  Add the installation prefix of "example_interfaces" to CMAKE_PREFIX_PATH or
  set "example_interfaces_DIR" to a directory containing one of the above
  files.  If "example_interfaces" provides a separate development package or
  SDK, be sure it has been installed.


---
Failed   <<< examples_rclcpp_minimal_action_client [4.11s, exited with code 1]
Aborted  <<< examples_rclcpp_minimal_action_server [4.08s]
Aborted  <<< examples_rclcpp_async_client [4.18s]
Aborted  <<< examples_rclcpp_cbg_executor [8.65s]                            

Summary: 0 packages finished [9.83s]
  1 package failed: examples_rclcpp_minimal_action_client
  3 packages aborted: examples_rclcpp_async_client examples_rclcpp_cbg_executor examples_rclcpp_minimal_action_server
  3 packages had stderr output: examples_rclcpp_async_client examples_rclcpp_minimal_action_client examples_rclcpp_minimal_action_server
  18 packages not processed
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2023-07-27 12:51:21 -0600

billy gravatar image

updated 2023-07-27 12:53:17 -0600

I typically install source code within the SCR folder and run COLON from the ROS2_WS folder. Looks like you did the opposite.

You also tagged HUMBLE in the question but downloaded FOXY examples. Make sure your examples match the version of the ROS2 being used.

edit flag offensive delete link more

Comments

I also tried building them in my home folder, does not help (why is my reply limited now ?)

pi@ros-pi:~/ros2_ws$ git clone https://github.com/ros2/examples src/examples -b humble
pi@ros-pi:~/ros2_ws$ colcon build --symlink-install
Starting >>> examples_rclcpp_async_client
Starting >>> examples_rclcpp_cbg_executor
Starting >>> examples_rclcpp_minimal_action_client                                                            
Starting >>> examples_rclcpp_minimal_action_server
--- stderr: examples_rclcpp_minimal_action_server                                                                             
CMake Error at CMakeLists.txt:14 (find_package):
  By not providing "Findexample_interfaces.cmake" in CMAKE_MODULE_PATH this
...
phil123456 gravatar image phil123456  ( 2023-07-27 14:47:23 -0600 )edit

thanks, I missed that foxy part

but it does not work, also the dir structure looks nothing like the one in the example

pi@ros-pi:~/WORK/ros2_ws$ git clone https://github.com/ros2/examples src/examples -b humble
pi@ros-pi:~/WORK/ros2_ws$ tree
.
??? src
    ??? examples
        ??? CONTRIBUTING.md
        ??? launch_testing
        ?   ??? launch_testing_examples
        ?       ??? CHANGELOG.rst
        ?       ??? launch_testing_examples
        ?       ?   ??? check_msgs_launch_test.py
        ?       ?   ??? check_multiple_nodes_launch_test.py
        ?       ?   ??? check_node_launch_test.py
        ?       ?   ??? hello_world_launch_test.py
        ?       ?   ??? __init__.py
        ?       ?   ??? record_rosbag_launch_test.py
        ?       ?   ??? set_param_launch_test.py
        ?       ??? package.xml
        ?       ??? README.md
phil123456 gravatar image phil123456  ( 2023-07-27 14:51:10 -0600 )edit

here

https://answers.ros.org/question/3316...

it says I have to install a git repo

https://github.com/ros2/example_inter...

where ? how ?

phil123456 gravatar image phil123456  ( 2023-07-27 15:09:30 -0600 )edit

Is there a reason you are not cloning into the SRC folder as instructed in the tutorials? I suggest you delete the entire ROS2_WS folder and start again. Once you try to COLCON BUILD with files in the wrong place, things get messed up,

And in case you think you don't need to source the environment as often as the tutorials tell you to, you do need to. Get in the habit of sourcing. Anything goes wrong, your first thing should be to verify you're sourcing as shown in tutorials.

billy gravatar image billy  ( 2023-07-27 15:11:45 -0600 )edit
  • the tutorial does not say anything, there is no cd instruction, you just have to guess
  • as mentioned, I tried putting the workspace in my home folder
  • I also tried launching colcon in the src folder

as I just mentioned, someone had the same issue, and mas missing that git repo but where do I clone it ?

pi@ros-pi:~/ros2_ws$ git clone https://github.com/ros2/examples_interfaces src/examples -b humble
fatal: destination path 'src/examples' already exists and is not an empty directory.
phil123456 gravatar image phil123456  ( 2023-07-27 15:14:54 -0600 )edit
phil123456 gravatar image phil123456  ( 2023-07-27 15:21:13 -0600 )edit

There are very extensive and complete examples and tutorials on the ROS.ORG website. https://docs.ros.org/en/humble/Tutorials.html If you haven't gone through those step by step you will have a very long and frustrating ROS2 experience. Do not try to learn ROS2 from github. That is hopeless.

As I suggested before, delete the entire ROS2_WS folder and start again. Clone the examples into the SCR folder and run COLCON BUILD from the ROS2_WS folder. It will not work any other way. And it won't work at all if you're not sourcing the environment.

billy gravatar image billy  ( 2023-07-27 15:40:05 -0600 )edit
  • I am actually following these very tutorials, hence the title of this post
  • I finally managed to make it work, that git repo was indeed missing and nothing is mentioned anywhere about it

I also put links to other people having the same issue

phil123456 gravatar image phil123456  ( 2023-07-27 15:43:17 -0600 )edit
1

answered 2023-07-28 09:38:42 -0600

phil123456 gravatar image

since it felt weird, to be sure, I been through the installation procedure

I reinstalled ros-humble-ros-base package, it update or installed tons of packages

while I am 100% sure I installed it before, I even wrote the procedure in my blog

so you were right @billy. thx for your help, man !

edit flag offensive delete link more

Comments

No problem.

billy gravatar image billy  ( 2023-07-28 14:21:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2023-07-27 12:14:45 -0600

Seen: 630 times

Last updated: Jul 28 '23