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

Building ROS2 Dashing Base from Source

asked 2021-06-04 19:56:02 -0500

mab0189 gravatar image

updated 2021-06-09 12:59:14 -0500

I am trying to build ROS2 Dashing from source on a Raspberry Pi with Raspbian Stretch. I followed this tutorial and everything went well until qt_gui_cpp failed because of an internal compiler error. The tutorial mentioned the following:

Note: if you are having trouble compiling all examples and this is preventing you from completing a successful build, you can use COLCON_IGNORE in the same manner as CATKIN_IGNORE to ignore the subtree or remove the folder from the workspace. Take for instance: you would like to avoid installing the large OpenCV library. Well then simply $ touch COLCON_IGNORE in the cam2image demo directory to leave it out of the build process.

For my use case i only need the ROS2 Base installation without any gui tools. I am unsure which of the directorys are needed for a base installation of ROS2. I would be very grateful if someone could help me out here.

When I ls in the src directory i get the following output:

ament  eclipse-cyclonedds  eProsima  osrf  ros  ros2  ros-perception  ros-planning  ros-visualization

Edit: I installed ROS2 Dashing from source. Great thanks to @ruffsl and @marguedas. For anyone that might to do this as well down below is everything i did. It is very similar to the tutorial but i am only installing the ros_core packages with the help of the rosinstall_generator. I also excluded the sros2 packages because i could not build them.

sudo apt update && sudo apt install locales
sudo locale-gen en_GB en_GB.UTF-8
sudo update-locale LC_ALL=en_GB.UTF-8 LANG=en_GB.UTF-8
export LANG=en_GB.UTF-8
locale 

sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-pip \
python-rosdep \
python3-vcstool \
wget

python3 -m pip install -U \
argcomplete \
flake8 \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
pytest-cov \
pytest-runner \
setuptools

sudo apt install --no-install-recommends -y \
libasio-dev \
libtinyxml2-dev

sudo apt install --no-install-recommends -y \
libcunit1-dev

sudo apt-get install python-rosinstall-generator

mkdir -p ~/ros2_dashing/src
cd ~/ros2_dashing/

rosinstall_generator ros_core --rosdistro dashing --deps --tar > dashing-ros-core.rosinstall
vcs import src < dashing-ros-core.rosinstall

sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro dashing -y --skip-keys "console_bridge fastcdr fastrtps libopensplice67 libopensplice69 rti-connext-dds-5.3.1 urdfdom_headers"

colcon build --symlink-install --packages-skip sros2 sros2_cmake ros_core

Edit: I have written a simple IPC.srv custom service. Everything worked fine on my Ubuntu 18.04 VM that also has ROS2 Dashing installed with Debian Packages.

char[10] request_data
---
int8 response_code

When i am compiling the package that contains the IPC.srv i get some strange std_err output like:

/usr/bin/ld: /home/TKI/ros2_dashing/install/rcl_yaml_param_parser/lib/librcl_yaml_param_parser.so: invalid string offset 1759 >= 1389 for section `.strtab'

I also noticed this output ... (more)

edit retag flag offensive close merge delete

Comments

Thank you for this! Worked for me with Ubuntu 20.04 on an Odroid XU4 with Foxy. The only difference is that I needed to alter the number of threads used during the build by setting export MAKEFLAGS="-j 4" as explained in this answer. Otherwise the build would fail due to using too many resources.

Aj_boatlanding gravatar image Aj_boatlanding  ( 2022-06-20 13:34:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-06-04 20:52:23 -0500

ruffsl gravatar image

updated 2021-06-05 13:08:08 -0500

You could include the vaerent repo into your workspace, and build only the packages up to the ros_base, e.g:

wget https://raw.githubusercontent.com/ros2/ros2/$ROS_DISTRO-release/ros2.repos
mkdir src
vcs import src < ros2.repos
git clone https://github.com/ros2/variants.git -b $ROS_DISTRO src/ros2/variants
colcon build --packages-up-to ros_base

As a reference for building ROS2 from source, you checkout the Dockerfiles located here: https://github.com/osrf/docker_images...

edit flag offensive delete link more

Comments

2

Or use rosinstall_generator: Core, base and desktop releases.

gvdhoorn gravatar image gvdhoorn  ( 2021-06-05 01:31:59 -0500 )edit

@ruffsl thank you very much for the answer i will try this out.

mab0189 gravatar image mab0189  ( 2021-06-05 08:02:31 -0500 )edit

@gvdhoorn That sounds also great but i am a bit unsure what i need to do after i execute:

rosinstall_generator ros_core --rosdistro dashing --deps --tar > dashing-ros-core.rosinstall

mab0189 gravatar image mab0189  ( 2021-06-05 08:09:58 -0500 )edit

@ruffsl thank you very much your answers seems to work! Unfortunatly the build fails on sros2, aborted rclcpp, ros2pkg and sensor_msgs and 45 packages had stderr output. The demos are not running. I wish arm32/armhf would get Tier1 support. So far i could only install ROS Kinetic successfully on the Raspberry Pi 3 with Stretch.

mab0189 gravatar image mab0189  ( 2021-06-05 11:05:16 -0500 )edit
1

Be sure that you've installed all the package dependencies that you'll need for the workspace. Refer to the ROS2 to build instruction documentation, or this: https://github.com/osrf/docker_images...

You could also try and getting away with skipping packages that failed to build. If you can reproduce the build issue, you may also want to file an issue ticket upstream on the package repo.

Also if you're building on the raspberry pi, you'll most likely run out of memory. I suggest looking into the various cross compilation projects for ROS2, or simply building the image on a workstation host using the target container image architecture with QEMU. https://discourse.ros.org/t/potential...

ruffsl gravatar image ruffsl  ( 2021-06-05 11:33:02 -0500 )edit
1

Or use rosinstall_generator: Core, base and desktop releases.

+1 using rosinstall_generator is a better way / more straight forward way of doing this

That sounds also great but i am a bit unsure what i need to do after i execute: rosinstall_generator ros_core --rosdistro dashing --deps --tar > dashing-ros-core.rosinstall

Then you need to import the repositories given by rosinstall_generator:

rosinstall_generator ros_core --rosdistro dashing --deps --tar > dashing-ros-core.rosinstall
mkdir src
vcs import src < dashing-ros-core.rosinstall

You could include the vaerent repo into your workspace, and build only the packages up to the ros_base, e.g: git clone https://github.com/ros2/variants.git src/ros2/variants

@ruffsl The content of the variants changes from one ROS distribution to another. So it is important to clone the branch corresponding to the distro you want to build. In this case "dashing"

marguedas gravatar image marguedas  ( 2021-06-05 12:44:36 -0500 )edit
1

Correct, added -b $ROS_DISTRO to the git clone.

ruffsl gravatar image ruffsl  ( 2021-06-05 13:09:20 -0500 )edit

@ruffsl I installed all package dependencies that were listed in the tutorial that i linked in my answer. I am not sure but sros2 seems like an important package since it is part of the ros_core installation. Thats why I am unsure if skipping is an option here. Another big problem is that the rclcpp client lib got aborted. I couldn't start the tutorials which is not a good sign. I have created an issue in the sros2 repo.

Does the -b make a huge difference here ? I did the following:

git clone https://github.com/ros2/variants.git src/ros2/variants

I really appreciate your suggestion with the cross compilation but i need to use a specific image for my thesis that i am currently working on. Thank you very much for your help! :-)

mab0189 gravatar image mab0189  ( 2021-06-05 14:03:23 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-06-04 19:56:02 -0500

Seen: 952 times

Last updated: Jun 09 '21