Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS2 Dashing build from source fails #265

Closed
mab0189 opened this issue Jun 5, 2021 · 8 comments
Closed

ROS2 Dashing build from source fails #265

mab0189 opened this issue Jun 5, 2021 · 8 comments
Labels
wontfix This will not be worked on

Comments

@mab0189
Copy link

mab0189 commented Jun 5, 2021

Bug report

Required Info:

Steps to reproduce issue

I followed this tutorial on how to install ROS2 Dashing from source on Linux. After that i followed the instruction provided by ruffsl in my ros answers question to install only the ros_core.

Here is everything i did:

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

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

wget https://raw.githubusercontent.com/ros2/ros2/dashing-release/ros2.repos
vcs import src < ros2.repos
git clone https://github.com/ros2/variants.git src/ros2/variants
colcon build --packages-up-to ros_core

Expected behavior

Build finishes without error.

Actual behavior

Build finishes with error:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__ rc = await self.task(*args, **kwargs) File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__ return await task_method(*args, **kwargs) File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build setup_py_data = get_setup_data(self.context.pkg, env) File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data return dict(pkg.metadata[key](env)) File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 130, in getter desc.path / 'setup.py', env=env) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 242, in get_setup_information setup_py, env=env) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 283, in _get_setup_information cwd=os.path.abspath(str(setup_py.parent)), check=True, env=env) File "/usr/lib/python3.5/subprocess.py", line 398, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith('_') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data['metadata'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1

Additional information

I can provide additional log files if needed.

@mab0189 mab0189 changed the title ROS2 Build from source fails ROS2 Dashing build from source fails Jun 5, 2021
@mikaelarguedas mikaelarguedas added the wontfix This will not be worked on label Jun 5, 2021
@mikaelarguedas
Copy link
Member

A few elements that may help you:

  • You're trying to build an EOL ROS distribution on an EOL Debian distribution on a non-officially supported Distribution and architecture, it is uncharted territory. Are you strongly attached to this configuration ? or would you consider using a more up-to date setup ?
    • If you are willing to use a different setup I recommend you to use a 64bit ubuntu on your raspberrry pi and this way you will be able to install ROS directly from the binaries instead of having to compile from source
  • The instructions you followed and the text you posted dont seem to match. You are missing some essential parts of the tutorial like installing the ROS packages dependencies.
    You should use rosdep to install the dependencies:
 rosinstall_generator ros_base --rosdistro dashing --deps --tar > dashing-ros-base.rosinstall \
    && vcs import src < dashing-ros-base.rosinstall
  sudo apt update && rosdep install -y --from-paths src --ignore-src --skip-keys "libopensplice69 rti-connext-dds-5.3.1" --rosdistro dashing

This looks very similar to #216 and may be due to Stretch providing Python 3.5 while ROS2 required Python 3.6 in Dashing

If you don't plan on using sros2, you can skip the failing packages:

colcon build --packages-skip sros2 sros2_cmake ros_core ros_base

I remember testing in the past in a container and was able to build successfully using that command.

Example of Dockerfile building ros_base on Debian Stretch
FROM debian:stretch

RUN apt-get update && apt-get install -q -y --no-install-recommends \
    bash-completion \
    dirmngr \
    gnupg2 \
    lsb-release \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# setup sources.list
RUN echo "deb http://packages.ros.org/ros2/ubuntu stretch main" > /etc/apt/sources.list.d/ros2-latest.list

# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
    build-essential \
    git \
    python3-colcon-common-extensions \
    python3-colcon-mixin \
    python3-rosdep \
    python3-vcstool \
    && rm -rf /var/lib/apt/lists/*

# install python packages
RUN pip3 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

RUN rosdep init \
    && rosdep update --rosdistro dashing

ENV ROS2_WS /opt/ros2_ws
RUN mkdir -p $ROS2_WS/src
WORKDIR $ROS2_WS

RUN apt-get update && apt-get install --no-install-recommends -y \
    python3-rosinstall-generator \
    && rm -rf /var/lib/apt/lists/*

RUN rosinstall_generator ros_base --rosdistro dashing --deps --tar > dashing-ros-base.rosinstall \
    && vcs import src < dashing-ros-base.rosinstall
RUN apt update && rosdep install -y --from-paths src --ignore-src --skip-keys "libopensplice69 rti-connext-dds-5.3.1" --rosdistro dashing
RUN colcon build --packages-skip sros2 sros2_cmake ros_core ros_base

@ruffsl
Copy link
Member

ruffsl commented Jun 5, 2021

  • If you are willing to use a different setup I recommend you to use a 64bit ubuntu on your raspberrry pi and this way you will be able to install ROS directly from the binaries instead of having to compile from source

👍

I remember testing in the past in a container and was able to build successfully using that command.

Here is another example using rosinstall with the devel images, but still just using galactic and arm32v7/ubuntu:focal

https://github.com/ruffsl/docker_images/pull/27

@mab0189
Copy link
Author

mab0189 commented Jun 5, 2021

@mikaelarguedas thank you very much for your answer. I can't change the OS because i need to use this specific image otherwise i would have switched already. I tried to install Foxy but during the installation a google package could not be installed because i am running Stretch. Dashing is not EOL yet as far as i know and was build for Stretch.

In the tutorial i linked there is no rosinstall_generator command. I changed the last commands so i am only installing the ros_core because for my use case I do not need the other things.

Since sros2 is part of ros_core i was unsure if i can skip it but why are you also skipping ros_core and ros_base? I am not familiar with Docker but i will try to follow the steps.

@mikaelarguedas
Copy link
Member

I tried to install Foxy but during the installation a google package could not be installed because i am running Stretch. Dashing is not EOL yet as far as i know and was build for Stretch.

Yes if you have to use Debian Stretch it is better to use Dashing than Foxy 👍

In the tutorial i linked there is no rosinstall_generator command. I changed the last commands so i am only installing the ros_core because for my use case I do not need the other things.

This tutorial is for building "all" of ROS2, which would require you to install many dependencies you won't need, this is why I'm suggesting using rosinstall_generator instead.
The main part I was referring to is that you dont seem to have ran the rosdep install part of the tutorial. That is the part that is essential to install the dependencies of the ros packages in your workspace.

Since sros2 is part of ros_core i was unsure if i can skip it but why are you also skipping ros_core and ros_base? I am not familiar with Docker but i will try to follow the steps.

This will depend on what parts of ROS you wil need to use. If you dont intend on using the ROS Security parts of ROS 2 (sros2) it is safe for you to not build it.

why are you also skipping ros_core and ros_base?

all the variants packages (ros_core, ros_base, desktop) are just packages without code that are used tolist a set of packages. as ros_core lists sros2 and sros2_cmake as necessary packages, it will not build successfully if not all its listed packages are present. This is why you'll have to skip ros_core.
Similarly, ros_base lists ros_core as a necessary package, so you have to skip it as ros_core will not be built.

I am not familiar with Docker but i will try to follow the steps.

You would need to start in an empty workspace. Otherwise following the steps in the dockerfile should work the same on your native system. You will just need to add sudo to all the apt calls as by default docker runs as root so there is no sudo used.

@mab0189
Copy link
Author

mab0189 commented Jun 5, 2021

I realised after my first try that the tutorial is installing "all" of ROS2. I only need the basic ROS2 communication to work for my project. Thats why i started this ros answers question. I tried the answer from @ruffsl.

You are right! - my bad. I did the rosdep install but I guess i missed to copy paste it. Keen eyes! 👍🏻

I followed the tutorial again now with a fresh image installation and stopped right before "Get ROS 2 code". I am trying to use the rosinstall_generator now.

Here is what i did:

sudo apt-get install python-rosinstall-generator

mkdir -p ~/ros2_dashing/src

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_base ros_core

I am still waiting for the build to finish and will post an update. It takes around 2+ hours on the Raspberry Pi 3 to build everything...

Edit:

all the variants packages (ros_core, ros_base, desktop) are just packages without code that are used tolist a set of packages. as ros_core lists sros2 and sros2_cmake as necessary packages, it will not build successfully if not all its listed packages are present. This is why you'll have to skip ros_core.
Similarly, ros_base lists ros_core as a necessary package, so you have to skip it as ros_core will not be built.

You are right. The build failed with on the ros_core package because sros2 ans sros2_cmake wasn't build. Good to know!
I only need to skip ros_core because ros_base does not exsist when i call the rosinstall_generator with ros_core.
The idea behind the package architecture of ROS is great but it is also a bit of a black box for me sometimes.
I really appreciate your help and explanations! :-)

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

@ruffsl
Copy link
Member

ruffsl commented Jun 5, 2021

I am still waiting for the build to finish and will post an update. It takes around 2+ hours on the Raspberry Pi 3 to build everything...

That is why I suggested on the answers page to either emulate the build using a arm32v7 docker image, or using one of the cross compile projects for ROS, e.g.:

https://github.com/ros-tooling/cross_compile

@mab0189
Copy link
Author

mab0189 commented Jun 5, 2021

@ruffsl To be honest, I'm a little overwhelmed in this area right now. For this reason, I'll try the slower but more familiar way first. Anyway, thank you very much i will look at it later!

@clalancette
Copy link
Contributor

Given the age of this one, I'm going to close this out. If you still need help, please consider opening a question at https://robotics.stackexchange.com/questions/tagged/ros

@clalancette clalancette closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants