Part of the snapcraft CLI’s development roadmap this cycle includes the ability to build snaps on distros other than Ubuntu. Part of that work includes investigating each plugin to determine if it’s possible to get it working on other distros. As a result, I’ve been looking into the Catkin plugin recently, using Fedora 27 as my proving ground (since that’s the distro with which I’m most familiar after Ubuntu).

The first thing you’ll notice trying to get ROS working on Fedora is that, unlike Ubuntu, where Open Robotics maintains infrastructure hosting a repository of Debian packages, there is no repository for you to use: you must build ROS from source. There’s some decent documentation for how to do this, but it’s severely lacking for Fedora, so I thought I’d share how I got it working.

The biggest issue I hit is that rosdep is completely useless for the dependencies of ROS itself. Honestly, I’m not sure why, a quick peek at the rules shows that it definitely supports Fedora. Maybe just none of the dependencies for ROS have Fedora 27 rules; I didn’t investigate.

So instead of using rosdep, I figured out the dependencies using good old trial and error. If you don’t feel like doing the same, you can borrow the ones I found (although I was only playing with ros_comm, no GUI tools):

# dnf install python-rosdep python-rosinstall_generator \
              python-rosinstall python-pyparsing \
              cmake gcc-c++ python-empy boost-devel console-bridge-devel \
              poco-devel python-devel tinyxml2-devel lz4-devel gtest-devel \
              bzip2-devel gpgme-devel python-defusedxml python-netifaces

Now create a workspace for ROS:

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws

Fetch the source for Melodic:

$ rosinstall_generator-2.7 ros_comm --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall
$ wstool init -j8 src melodic-ros_comm.rosinstall

Now build ROS:

$ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Finally, you can source the setup.bash for the workspace as usual:

$ source ~/ros_catkin_ws/install_isolated/setup.bash

Now you can run e.g. roscore:

$ roscore
... logging to /root/.ros/log/35<snip>85d360/roslaunch-fedora-ros-19796.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://fedora-ros:34509/
ros_comm version 1.14.1


* /rosdistro: melodic
* /rosversion: 1.14.1


auto-starting new master
rocess[master]: started with pid [19806]

setting /run_id to 35d993ce-6062-11e8-bcab-00163e85d360
process[rosout-1]: started with pid [19817]
started core service [/rosout]

Anyway, just wanted to get that out there for posterity, and in case it helps anyone else.