0
$\begingroup$

Rosanswers logo

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 while building ROS2 Dashing from source. Sould i be concerned about this? My nodes are running fine but i noticed that the time between a service request and service response is very high. I am running the service tutorial nodes. I am unsure if this is might be the cause. I also noticed that ROS2 is taking around 90% cpu load once i start a service request. Topics seem to work normal. I would be very grateful if somebody could help me out here.


Originally posted by mab0189 on ROS Answers with karma: 37 on 2021-06-04

Post score: 0


Original comments

Comment by Aj_boatlanding on 2022-06-20:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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/blob/master/ros2/source/source/Dockerfile


Originally posted by ruffsl with karma: 1094 on 2021-06-04

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by gvdhoorn on 2021-06-05:
Or use rosinstall_generator: Core, base and desktop releases.

Comment by mab0189 on 2021-06-05:
@ruffsl thank you very much for the answer i will try this out.

Comment by mab0189 on 2021-06-05:
@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

Comment by mab0189 on 2021-06-05:
@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.

Comment by ruffsl on 2021-06-05:
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/blob/fbc8e9b3611722c7c9cba994be4589ea87140aad/ros2/source/source/Dockerfile#L24

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-downgrade-of-arm32-support-to-tier-3/14136/2

Comment by marguedas on 2021-06-05:\

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"

Comment by ruffsl on 2021-06-05:
Correct, added -b $ROS_DISTRO to the git clone.

Comment by mab0189 on 2021-06-05:
@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! :-)

Comment by mab0189 on 2021-06-05:
@marguedas thank you very much for the answer.

Comment by marguedas on 2021-06-05:
A response on the sros2 corresponding issue: https://github.com/ros2/sros2/issues/265#issuecomment-855282342. lt also provides a way to build dashing on stretch using rosinstall_generator

Comment by mab0189 on 2021-06-05:
I will try it with the rosinstall_genrator commands in the comment of @merguedas. Just to be sure after that i need to run colcon build --symlink-install ? I will also make a COLCON_IGNORE in the sros2 and the sros2_cmake directory.

Comment by gvdhoorn on 2021-06-06:
@mab0189: could you please not cross-post like this in the future? Both @marguedas and @ruffsl are now duplicating advice and referring to the issue and vice-versa.

Comment by mab0189 on 2021-06-06:
@gvdhoorn i am trying my best to follow the guidelines. I understand your concern about the cross-posting. I have received helpful recommendations and answers from everyone on my initial question for which i am very grateful. Since my second problem was primarily with sros2 i thought it would be better to open a issue on github.I am a bit unsure about how to handle questions that develop into other questions.

Comment by ruffsl on 2021-06-13:
You may want to start a new question to address your CPU usage and performance issues. When doing so, try and form a minimal example that is reproducible with say a single Dockerfile.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.