I’ll use this topic to record all the steps I’m taking in case someone finds them useful.
I’m using an Ubuntu Server 22.04.3 preinstalled image that can be download from here. I also use QEMU 8.2.1 to emulate a RISC-V machine. For QEMU, we need additional boot files, which can be downloaded from here.
I’m working on an isolated ros2-riscv
directory, and I have the Ubuntu image, the bios
and the kernel
files in ros2-riscv/boot
. So, to start QEMU, just type the following command:
qemu-system-riscv64 \
-machine virt -nographic -m 4096 -smp 4 \
-bios boot/fw_jump.elf \
-kernel boot/uboot.elf \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-drive file=boot/ubuntu-22.04.3.img,format=raw,if=virtio
Now that we “are” on a RISC-V Ubuntu machine, let’s get some inspiration from the ROS 2 installation from source guide.
The main issue is that we cannot use the ROS 2 repository, because it does not provide binaries for RISC-V. So we are going to be alternatively working with apt
and pip
to get the dependencies.
System setup
Set locale
This is exactly the same as in the official instructions:
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
Enable required repositories
Here things differ a bit. I think we can only do the following:
sudo apt install software-properties-common
sudo add-apt-repository universe
Install dependencies
Okay, let’s try to install all the stuff required but without using ros-dev-tools
. We will use apt
and pip
:
sudo apt update && sudo apt upgrade && sudo apt install -y \
build-essential \
cmake \
git \
apt-utils \
ca-certificates \
conntrack \
curl \
dh-python \
dhcpcd5 \
ebtables \
ethtool \
git-lfs \
gnupg2 \
ifupdown \
iptables \
iproute2 \
iputils-ping \
libasio-dev \
libbullet-dev \
libconsole-bridge-dev \
libtinyxml2-dev \
libeigen3-dev \
lsb-release \
net-tools \
openssh-client \
python3-dev \
python3-distlib \
python3-empy \
python3-lark \
python3-notify2 \
python3-numpy \
python3-pip \
python3-pytest-cov \
python3-setuptools \
python3-yaml \
samba \
socat \
systemd \
vim \
wget
DISCLAIMER: Probably we don’t need ALL those dependencies. Feel free to opt out some of them (and share with us )
There are still some dependencies missing that are not available without ROS 2 repo. Let’s use pip
for them:
sudo pip install vcstool \
rosdep \
catkin-pkg-modules \
rosdistro-modules \
colcon-common-extensions
So far so good. Let’s move to building ROS 2.
Build ROS 2
Get ROS 2 code
The same as in the official docs:
mkdir -p ~/ros2_iron/src
cd ~/ros2_iron
vcs import --input https://raw.githubusercontent.com/ros2/ros2/iron/ros2.repos src
Install dependencies using rosdep
Here things start being a bit tricky:
sudo rosdep init
rosdep update
rosdep install -r --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
Take a closer look: I added the -r
option to ignore failures. rosdep
assumes we have access to the ROS repo and uses apt
to install some dependencies. apt
will fail finding some dependencies. Thankfully, we could download them using pip
previously. In any case, rosdep
will print which packages failed, so you can double-check that we installed them using pip
previously and that we are good to go.
Build the code in the workspace
I’m currently stuck here. If you run the following command:
colcon build --symlink-install
It starts building some dependencies… but it will eventually fail with mimick_vendor
. In essence, mimick_vendor
just tries to compile the Mimick
package which does not support RISC-V architectures. However, the original fork of this package has an open PR that DOES provide support for RISC-V. Sadly, it seems that the author is not very active. However, I already opened a few issues asking the maintainers of ROS 2 Mimick to add this functionality.
From now, I’ll tweak the ROS dependency list to point to this fork that provides support for RISC-V and see if I can advance in the installation. I’ll keep you updated.