Pages

Tuesday, October 22, 2013

Installing ROS on Arch (part 1)

Call me masochistic, but today I try and install ROS on Arch Linux. If you guys don't know Arch is this really cool distro that's pretty much always on the bleeding edge of things and has a huge and supportive community behind it. There are plenty of pre-compiled packages for the core and a huge user repository where everyone can make their own package to be downloaded and compiled by others. It is quite peachy. ROS on the other hand is this monster of software that's basically only supported on Ubuntu and has a dependency tree larger that xorg or gnome combined (citation needed).

Now, why would I want to run ROS on Arch? It's simple: Arch is my current system and I have it set up the way I like it, but I need to use ROS to write code for this new piece of awesome technology we bought, the Allegro Hand. It's currently a secondary project, but I plan on getting the hand running on my machine so I don't have to ssh (or, even worse, physically log in) to a Ubuntu machine every time I want to test out code. But, back to the problem at hand (hehe).

Along with this huge dependency tree there's another problem: the default python on Arch is python3 while ROS assumes that everyone in their right minds would use python2 as their default, so it simply hardcodes the string "python" in every script and path because... well... why would anyone have /usr/bin/python point to anything else than python2? Does a different version of python even exist? (deep sarcasm). Anyway this is a problem I'll get to later, because we don't encounter it until we download the sources, which is itself sort of a pain. 

First off, the best thing you can do for yourself if you are running Arch is to install yaourt, from the french repositories. The french word for yogurt, this is an awesome little tool that lets you install AUR packages with more or less the same amount of effort as regular packages. It's also a transparent wrapper for pacman, so all the commands you know and love work exactly the same way.

Now that you have yaourt it's time to install some dependencies. These are the things I had to install:
aur/wstool-git
aur/python2-rospkg
aur/python2-catkin_pkg
aur/python2-rosinstall_generator-git
aur/ros-arch-deps
That last one took a long time and maybe the first four should be listed as dependencies to it, I don't know. Maybe one doesn't even need it. Let me know if you know. Anyway, I installed it. Then, I followed the steps in the ROS installation document:
$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
$ rosinstall_generator desktop --rosdistro hydro \
> --deps --wet-only > hydro-desktop-wet.rosinstall
$ wstool init -j8 src hydro-desktop-wet.rosinstall
 What this did was pull the source for hydro with the desktop variant in ~/ros_catkin_ws/src

Ok now that we're here we're gonna skip the call to rosdep because that's going to just give us errors saying that we don't have the required dependencies because they don't exist on arch. I am NOT patching rosdep to take care of that. Instead I go right ahead and try and build the damned thing:
$ ./src/catkin/bin/catkin_make_isolated --install
But guess what! This errors out, because catkin_make is a python script and it calls python expecting it to be python2, but instead it gets python3 on my system. None of the things we just installed are present for python3, since they only have python2 versions. Ugly ugly.  I still don't know how to fix this, other than a sed on all the files in the src folder. And for those asking, hell no I'm not gonna change my default python system wide. It's not a matter of ease, it's a matter of principle dammit.

No comments:

Post a Comment