ros-tooling / cross_compile

A tool to build ROS and ROS2 workspaces for various targets
Apache License 2.0
188 stars 60 forks source link

Error issue from rosdep during ros_cross_compile from Virtualbox ubuntu bionic 18.04 #203

Closed mce16 closed 4 years ago

mce16 commented 4 years ago

As per error output, it said no /src directory found; I looked in the rosdep.Dockerfile, is the src/ missing in the mkdir -p /ws?

I am not sure if this is the case, and also not sure how this can be corrected.

Below is my one line command, running from virtualbox, ubuntu bionic 18.04; docker installed.

kk@kk-VirtualBox:~/cc_ws$ ros_cross_compile ros2_ws --arch aarch64 --os ubuntu --rosdistro dashing
<pre>   rosdep update

INFO:Docker Client: ---> 11862f5def1c INFO:Docker Client:Step 7/10 : COPY gather_rosdeps.sh /root/ INFO:Docker Client: ---> 8c9e7f3398eb INFO:Docker Client:Step 8/10 : RUN mkdir -p /ws INFO:Docker Client: ---> Running in 20e904cd622f INFO:Docker Client: ---> b22e62d727d1 INFO:Docker Client:Step 9/10 : WORKDIR /ws INFO:Docker Client: ---> Running in 65122d66b95c INFO:Docker Client: ---> dcc15e4b876b INFO:Docker Client:Step 10/10 : ENTRYPOINT ["/root/gather_rosdeps.sh"] INFO:Docker Client: ---> Running in 9e942006b978 INFO:Docker Client: ---> dc487cf63ae0 INFO:Docker Client:Successfully built dc487cf63ae0 INFO:Docker Client:Successfully tagged ros_cross_compile:rosdep INFO:Rosdep Gatherer:Running rosdep collector image on workspace ros2_ws INFO:Docker Client:No src/ directory found at /ws, did you remember to mount your workspace? INFO:Docker Client:+ '[' '!' -d ./src ']' INFO:Docker Client:++ pwd INFO:Docker Client:+ echo 'No src/ directory found at /ws, did you remember to mount your workspace?' INFO:Docker Client:+ exit 1 Traceback (most recent call last): File "/home/kk/.local/bin/ros_cross_compile", line 11, in <module> sys.exit(main()) File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/ros_cross_compile.py", line 172, in main cross_compile_pipeline(args) File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/ros_cross_compile.py", line 163, in cross_compile_pipeline custom_data_dir=custom_data_dir) File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/dependencies.py", line 84, in gather_rosdeps volumes=volumes, File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/docker_client.py", line 141, in run_container image_name, exit_code, '', image_name, 'See above ^') docker.errors.ContainerError: Command '' in image 'ros_cross_compile:rosdep' returned non-zero exit status 1: See above ^

emersonknapp commented 4 years ago

Is ~/cc_ws/ros_ws/src/ an existing directory? What happens if you try providing an absolute path, e.g. ros_cross_compile $(pwd)/ros_ws etc...?

mce16 commented 4 years ago

No, there is no src/ in ~/cc_ws/ros_ws/

The result is the same if i do the following:

kk@kk-VirtualBox:~/cc_ws$ ros_cross_compile $(pwd)/ros2_ws --arch aarch64 --os ubuntu --rosdistro dashing

And now if i were to create a src/ in ~/cc_ws/ros_ws/; it seems to get passed the error above; but with a new issue pops up like below:

INFO:Docker Client:rosdep update
INFO:Docker Client:  update the local rosdep database based on the rosdep sources.
INFO:Docker Client:
INFO:Docker Client:rosdep what-needs <rosdeps>...
INFO:Docker Client:  print a list of packages that declare a rosdep on (at least
INFO:Docker Client:  one of) <rosdeps>
INFO:Docker Client:
INFO:Docker Client:rosdep where-defined <rosdeps>...
INFO:Docker Client:  print a list of yaml files that declare a rosdep on (at least
INFO:Docker Client:  one of) <rosdeps>
INFO:Docker Client:
INFO:Docker Client:rosdep fix-permissions
INFO:Docker Client:  Recursively change the permissions of the user's ros home directory.
INFO:Docker Client:  May require sudo.  Can be useful to fix permissions after calling
INFO:Docker Client:  "rosdep update" with sudo accidentally.
INFO:Docker Client:
INFO:Docker Client:
INFO:Docker Client:rosdep: error: no packages or stacks specified
Traceback (most recent call last):
  File "/home/kk/.local/bin/ros_cross_compile", line 11, in <module>
    sys.exit(main())
  File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/ros_cross_compile.py", line 172, in main
    cross_compile_pipeline(args)
  File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/ros_cross_compile.py", line 163, in cross_compile_pipeline
    custom_data_dir=custom_data_dir)
  File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/dependencies.py", line 84, in gather_rosdeps
    volumes=volumes,
  File "/home/kk/.local/lib/python3.6/site-packages/ros_cross_compile/docker_client.py", line 141, in run_container
    image_name, exit_code, '', image_name, 'See above ^')
docker.errors.ContainerError: Command '' in image 'ros_cross_compile:rosdep' returned non-zero exit status 2: See above ^
emersonknapp commented 4 years ago

The one positional argument to the tool is intended to be a workspace that you desire to cross-compile. It needs to be a valid colcon workspace, e.g. it contains a src/ directory with ros package sources in it. Perhaps there is a different path to the workspace that you intend to build, or maybe a different mismatch of expectation?

mce16 commented 4 years ago

I see. Thanks for the explanation. I think as new user, it would be helpful too if this info can be included in the READ-ME as well. I sort of thinking a default ros2 source and packages would be downloaded and use unless specified otherwise, or something to that effect.

Now, i have finally built it successfully in virtualbox, i have a question on its lengthy built time. When build for x86 virtualbox, it took me 1.5hrs. And on aarch64, it was a whopping 15+ hours.

See below part of the console output:

INFO:Docker Client:[Processing: test_rclcpp]
INFO:Docker Client:[Processing: test_rclcpp]
INFO:Docker Client:[Processing: test_rclcpp]
INFO:Docker Client:Finished <<< test_rclcpp [27min 49s]
INFO:Docker Client:Starting >>> tf2_eigen
INFO:Docker Client:[Processing: tf2_eigen]
INFO:Docker Client:[Processing: tf2_eigen]
INFO:Docker Client:Finished <<< tf2_eigen [1min 17s]
INFO:Docker Client:Starting >>> tf2_kdl
INFO:Docker Client:[Processing: tf2_kdl]
INFO:Docker Client:[Processing: tf2_kdl]
INFO:Docker Client:Finished <<< tf2_kdl [1min 9s]
INFO:Docker Client:Starting >>> tf2_sensor_msgs
INFO:Docker Client:Finished <<< tf2_sensor_msgs [22.2s]
INFO:Docker Client:Starting >>> dummy_robot_bringup
INFO:Docker Client:Finished <<< dummy_robot_bringup [18.9s]
INFO:Docker Client:Starting >>> pendulum_control
INFO:Docker Client:[Processing: pendulum_control]
INFO:Docker Client:[Processing: pendulum_control]
INFO:Docker Client:Finished <<< pendulum_control [1min 30s]
INFO:Docker Client:Starting >>> ros1_bridge
INFO:Docker Client:--- stderr: ros1_bridge
INFO:Docker Client:CMake Warning at CMakeLists.txt:34 (message):
INFO:Docker Client:  Failed to find ROS 1 roscpp, skipping...
INFO:Docker Client:
INFO:Docker Client:
INFO:Docker Client:---
INFO:Docker Client:Finished <<< ros1_bridge [24.9s]
INFO:Docker Client:Starting >>> ros2lifecycle
INFO:Docker Client:Finished <<< ros2lifecycle [7.82s]
INFO:Docker Client:Starting >>> lifecycle
INFO:Docker Client:[Processing: lifecycle]
INFO:Docker Client:[Processing: lifecycle]
INFO:Docker Client:Finished <<< lifecycle [1min 23s]
INFO:Docker Client:Starting >>> ros2component
INFO:Docker Client:Finished <<< ros2component [7.97s]
INFO:Docker Client:Starting >>> rqt_action
INFO:Docker Client:Finished <<< rqt_action [7.31s]
INFO:Docker Client:Starting >>> rqt_srv
INFO:Docker Client:Finished <<< rqt_srv [18.4s]
INFO:Docker Client:Starting >>> rosbag2_tests
INFO:Docker Client:[Processing: rosbag2_tests]
INFO:Docker Client:[Processing: rosbag2_tests]
INFO:Docker Client:[Processing: rosbag2_tests]
INFO:Docker Client:[Processing: rosbag2_tests]
INFO:Docker Client:[Processing: rosbag2_tests]
INFO:Docker Client:Finished <<< rosbag2_tests [2min 36s]
INFO:Docker Client:Starting >>> rviz2
INFO:Docker Client:[Processing: rviz2]
INFO:Docker Client:[Processing: rviz2]
INFO:Docker Client:Finished <<< rviz2 [1min 14s]
INFO:Docker Client:
INFO:Docker Client:Summary: 271 packages finished [15h 11min 47s]
INFO:Docker Client:  6 packages had stderr output: cyclonedds rmw_connext_cpp rmw_connext_shared_cpp ros1_bridge rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp
INFO:Docker Client:+ chown -R 1000 .

What could be the reason for such a huge (10x) difference? Or is this particular to my setup only?

emersonknapp commented 4 years ago

The main problem is emulation - it is a lot slower than native builds. We're working on moving to native cross-compilation, which should be more comparable to a native build and take about the same amount of time. This will be a big improvement but probably won't be ready for another couple months.

Regardless, building the entire ros2 desktop installation from source is not really the intended use case - especially not building all the GUI tools which probably shouldn't be used on ARM devices anyways. ROS2 is already built and packaged for aarch64 on ci.ros2.org / build.ros2.org . The real purpose of this tool is to build your application, finding dependencies via package.xml, and the tool will use the prebuilt packages that already exist for Ubuntu on ARM. If you only have a few packages in your workspace this process will be reasonably fast, especially on subsequent builds - the first run to create the dependency sysroot is going to be a little bit slow.

it would be helpful too if this info can be included in the READ-ME as well

The README's first sentence is: "A tool to automate compiling ROS and ROS 2 workspaces to non-native architectures.". Is there a way we could make this more clear?

emersonknapp commented 4 years ago

Closing this in favor of tracking cross-compiler usage in https://github.com/ros-tooling/cross_compile/issues/69