[Documentation] [TitleIndex] [WordIndex

Installation Instructions for Groovy in Arch Linux

This page describes how to install Groovy in Arch Linux. Arch Linux is not officially supported by ROS and the installation might fail for several reasons. This page does not (yet) contain instructions for most higher level ROS packages, only for the base system. This includes the middleware and command line tools but not much more.

Method 1: Using the AUR Packages

The current most straightforward way to install ROS Groovy is using the AUR packages that start with ros-groovy. Using a helper such as yaourt or packer, it is possible to install all packages related to ROS groovy and let the Arch Build System take care of all the dependencies involved. In the following simple examples I will be using yaourt, however, it is trivial to replace it with packer. In order to see what packages are avaible, simply use:

yaourt ros-groovy

Or view the list of packages online. It is then possible to install a specific subset of the packages (or all of them, using a string like 1-112).

In order to avoid all of the prompts when installing a large number of packages, the use of the following flag may be applied (be warned that you will NOT be prompted for confirmation on any of the packages, only for your password)

yaourt --noconfirm ros-groovy

Using this method, you will be asked only once for the password, and all following packages will be installed without asking the using to edit any PKGBUILD or confirm a package installation. Be warned that should a failure occur in one of the builds, you will not be able to edit a PKBUILD. You can, however, attempt to install that specific package alone and then restart the build process without having to reinstall every package. For instance, should the package ros-groovy-actionlib-msgs fail, you can check it separately with the following procedure:

yaourt -S ros-groovy-actionlib-msgs

Depending on where it fails, different actions are possible. To restart the building process without rebuilding all of the packages, a simple

yaourt --noconfirm --needed ros-groovy

and selecting the packages you want to install will suffice. Once this is done, you will have a complete ROS Groovy installation in /opt/ros/groovy, and you can proceed to follow the ROS Tutorials online. Note, however, that a few extra steps need to be taken:

First, install rosdep with

yaourt -S python2-rosdep

Then, initialize rosdep with

sudo rosdep init
rosdep update

Finally, when initializing a catkin workspace, as specified in the tutorial pages, instead of issuing the command

catkin_make

the flag "-DPYTHON_EXECUTABLE=/usr/bin/python2" will need to be added, as in

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2

This step will not be necessary when installing every package, but if an error occurs mentioning a version of python 3, then it will be needed in order to specify the right version. There are other ways to avoid this; one of them involves linking the python2 executable as follows:

mkdir ~/bin
ln -s /usr/bin/python2 ~/bin/python
export PATH=~/bin:$PATH

This will make it so that the python2 executable is found before the other one.

Method 2: Manual Build

This method grants a bit more control, but is more complicated and will still require the installation of several AUR packages.

Prerequisites

First, install a few dependencies.

sudo pacman -S python2 gcc boost cmake libyaml yaml-cpp python2-yaml python2-nose python2-paramiko python2-netifaces tinyxml lsb-release bzip2 python2-pip mercurial subversion git pkg-config jshon make

Now we need to build a few dependencies from source. For that, AUR Helpers are most useful. For instance, install packer.

wget https://aur.archlinux.org/packages/pa/packer/packer.tar.gz
tar -zxvf packer.tar.gz 
cd packer
makepkg PKGBUILD 
sudo pacman -U packer*.pkg.tar.xz

Install additional dependencies from source:

sudo packer -S python2-empy log4cxx gtest

For the Raspberry Pi , edit the files when prompted and change the arch= line into arch=('armv6h')

Finally, we need to install a few ROS python tools using pip2:

sudo pip2 install -U rospkg rosdep rosinstall catkin-pkg wstool

In order to use rosdep, we need to initialize it:

sudo rosdep init
rosdep update

Building ROS Base

First, check out all ROS base packages:

wstool init src -j8 http://prerelease.ros.org/rosinstall/generate/raw/groovy/ros_comm

This generates a CMakeLists.txt for Fuerte, so we need to get rid of it and link catkin's toplevel cmake file:

cd ~/groovy_underlay/src
ln -s catkin/cmake/toplevel.cmake CMakeLists.txt

Before we can actually invoke cmake, we first need to deal with the python issue. Arch uses Python 3 while ROS still requires Python 2. All we need to do is to fix all python shebang lines. The following command does that for us:

for file in $(grep -rl 'env python *$' .); do sed -i 's/env python *$/env python2/g' $file ;done

or just follow the suggested Archlinux fix by creating a bin directory within your home directory and set a link to the Python 2.7 executable.

$ mkdir ~/bin
$ ln -s /usr/bin/python2 ~/bin/python
$ export PATH=~/bin:$PATH

Now it's time for configuring the build:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/groovy -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so -DSETUPTOOLS_DEB_LAYOUT=OFF

The configure should not throw an error. After running it, we can finally build and install ROS:

However, I first had to edit src/genmsg/src/genmsg/gentools.py and chenge line 90 from return buff.getvalue().strip() into return buff.getvalue().strip().encode('utf-8')

make -j8
sudo make install

This will install everything in /opt/ros/groovy. To use our freshly built ROS installation, we need to source its setup file:

source /opt/ros/groovy/setup.bash

Community

If you would like to contribute to packaging ROS on Arch try [https://wiki.archlinux.org/index.php/Talk:Ros]


2022-05-28 12:37