[Documentation] [TitleIndex] [WordIndex

Installation Instructions for Hydro in Arch Linux

This page describes how to install Hydro 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

Installing an AUR helper

First, install base-devel that contains everything needed by makepkg to compile packages on Arch Linux:

pacman -S base-devel

The current most straightforward way to install ROS Hydro is using the AUR packages that start with ros-hydro. Using a helper such as yaourt or packer, it is possible to install all packages related to ROS Hydro and let the Arch Build System take care of all the dependencies involved.

To install yaourt, you can add the archlinuxfr repository to /etc/pacman.conf:

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

Then, simply run:

pacman -Sy yaourt

Or if you decide to go for packer:

pacman -Sy packer

Preliminary configuration

Some settings will make the installation process faster:

You should also make sure that [core], [extra] and possibly [community] are enabled in your /etc/pacman.conf, since some dependencies are part of these official repositories.

Installing AUR Packages

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-hydro

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-hydro

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-hydro-actionlib-msgs fail, you can check it separately with the following procedure:

yaourt -S ros-hydro-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-hydro

and selecting the packages you want to install will suffice. Once this is done, you will have a complete ROS Hydro installation in /opt/ros/hydro, 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

Some users could experience problems with the last command. In this case, remove the python2-rosdep package and install python2-pip. Therefore, rosdep could be installed using pip2. In the following, these steps are summarized:

yaourt -Rsc python2-rosdep
yaourt -S python2-pip
sudo pip2 install -U rosdep

Therefore, init and update rosdep:

sudo rosdep init
rosdep update

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

catkin_make

some Python 2 flags will need to be added, as in

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so

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
# Then
alias python=~/bin/python
# or:
export PATH=~/bin:$PATH

This will make it so that the python2 executable is found before the other one. HOWEVER, if you install AUR packages that rely on the python executable, the Python 2 version will be installed instead of the Python 3 version.

Thus, you should create a shell function that sets everything ROS-related, and run that function when you want to use some shells for ROS. For instance, you can add something like this in your ~/.bashrc:

# ROS
hydro() {
  source /opt/ros/hydro/setup.bash
  export ROS_PACKAGE_PATH=/path/to/your/your/package/path:$ROS_PACKAGE_PATH
  export PYTHONPATH=/opt/ros/hydro/lib/python2.7/site-packages:$PYTHONPATH
  export PKG_CONFIG_PATH="/opt/ros/hydro/lib/pkgconfig:$PKG_CONFIG_PATH"
  alias python=/usr/bin/python2

  # Gazebo
  source /usr/share/gazebo/setup.sh
}

Then, in a shell:

$ hydro
$ roscore

Adding New AUR Packages

If you want to help packaging for Arch Linux, you can use import_catkin_packages.py available in ros-build-tools. You can fork arch-ros-stacks and contribute by doing this:

# Go to ros-build-tools upstream scripts
cd /path/to/arch-ros-stacks/dependencies/ros-build-tools

# List available packages
python2 import_catkin_packages.py --distro=hydro --output-directory=/path/to/arch-ros-stacks/hydro --list | less

# Generate PKGBUILD for a given package and its dependencies
python2 import_catkin_packages.py --distro=hydro --output-directory=/path/to/arch-ros-stacks/hydro -r package_name

# Go to newly created package(s) directory
cd ../../hydro/package_name

# Build, install, add to Git and create AUR source tarball
# You may need to apply some patches in the PKGBUILD (e.g. for Ogre 1.8)
# mkaurball is available in pkgbuild-introspection [community], and
# automatically generates the .AURINFO file
makepkg -if && git add PKGBUILD && mkaurball

After that, you can upload the new package's *.src.tar.gz to the AUR, commit and make a pull request on GitHub. Thus, other Arch Linux users will be able to install your package by simply typing:

yaourt ros-hydro-package-name

Note that you can also create PKGBUILDs manually (just copy another package's PKGBUILD and adapt it), but the automatic process is probably the safest option, since it gets the latest release version, the adequate dependencies, the short description etc.

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

TBD

Building ROS Base

TBD

Community

If you would like to contribute to packaging ROS on Arch, check arch-ros-stacks on GitHub (as explained in #1.2), or even [https://wiki.archlinux.org/index.php/Talk:Ros].


2024-12-21 14:57