[Documentation] [TitleIndex] [WordIndex

Installing On Gentoo

Gentoo installation is considered experimental. The installation is quite functional, though. Notice: on Funtoo Linux, the following instructions work, but you will need to make several modifications (so proceed at your own risk).

Prerequisites

Selecting Python 2.7

Currently, we need to use Python-2.7. To do so, we will use eselect.

Then do the following command to select 2.7.

We will also install some other libraries for ROS, such as OpenCV, Gazebo and Bullet.

If gazebo fails to install, which is highly probable at the moment, omit it from the above command:

# emerge sci-physics/bullet media-libs/opencv --jobs --load-average `nproc`

Installing the Overlay

Before proceeding, the necessary tools for installing ROS must be installed on your system. To do so, you need to install Layman, an overlay manager for Gentoo.

Now we add the overlay with the necessary Gentoo packages.

Now we install the necessary tools for installation.

Add the following lines to the end of /etc/portage/package.use.

At this point, it is strongly advised that you perform a full system update.

Initializing rosdep

$ sudo rosdep init
$ rosdep update

Installation

Start by building the core ROS packages.

Building the catkin Packages

ROS is in the process of converting to a new build system, catkin, but not all of the packages have been converted and the two build systems cannot be used simultaneously. Therefore it is necessary to build the core ROS packages first (catkin packages) and then the rest.

Create a catkin Workspace

In order to build the core packages, you will need a catkin workspace. Create one now:

Next we will want to fetch the core packages so we can build them. We will use wstool for this. Select the wstool command for the particular variant you want to install.

This will add all of the catkin or wet packages in the given variant and then fetch the sources into the ~/ros_catkin_ws/src directory. The command will take a few minutes to download all of the core ROS packages into the src folder. The -j8 option downloads 8 packages in parallel.

If wstool init fails or is interrupted, you can resume the download by running:

wstool update -j 4 -t src

Resolving Dependencies

Before you can build your catkin workspace you need to make sure that you have all the required dependencies. We use the rosdep tool for this:

This will look at all of the packages in the src directory and find all of the dependencies they have. Then it will recursively install the dependencies.

The --from-paths option indicates we want to install the dependencies for an entire directory of packages, in this case src. The --ignore-src option indicates to rosdep that it shouldn't try to install any ROS packages in the src folder from the package manager, we don't need it to since we are building them ourselves. The --rosdistro option is required because we don't have a ROS environment setup yet, so we have to indicate to rosdep what version of ROS we are building for. Finally, the -y option indicates to rosdep that we don't want to be bothered by too many prompts from the package manager.

After a while (and maybe some prompts for your password) rosdep will finish installing system dependencies and you can continue.

Lastly, we need to do the following:

Building the catkin Workspace

Once it has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages. We will use the catkin_make_isolated command because there are both catkin and plain cmake packages in the base install, when developing on your catkin only workspaces you should use catkin/commands/catkin_make.

Invoke catkin_make_isolated:

Now the packages should have been installed to /opt/ros/kinetic/ or to wherever you specified with the --install-space argument. If you look in that directory you will see that a setup.bash file have been generated. To utilize the things installed there simply source that file. Lets do that now before building the rest of ROS:

To verify that your ROS install is operational, try and run roscore. You should get something similar to the image below.

roscore running on Gentoo Linux

Post-Installation Instructions

Creating a Workspace

It's recommended that you do your work in a separate ros workspace. To make one named catkin_ws, run the following.

Editing Environment Variables

Now we add some lines to our ~/.bashrc file. Add these lines, replacing catkin_ws with the name you chose above.

Install GMapping

Next we demonstrate how to install extra packages, such as GMapping.

with luck, you should now have GMapping.

Maintaining a Source Checkout

If we want to keep our source checkout up to date, we will have to periodically update our rosinstall file, download the latest sources, and rebuild our workspace.

Update the workspace

To update your workspace, first move your existing rosinstall file so that it doesn't get overwritten, and generate an updated version. For simplicity, we will cover the *destop-full* variant. For other variants, update the filenames and rosinstall_generator arguments appropriately.

$ mv -i kinetic-desktop_full-wet.rosinstall kinetic-desktop_full-wet.rosinstall.old
$ rosinstall_generator desktop_full --rosdistro kinetic --deps --wet-only --tar > kinetic-desktop_full-wet.rosinstall

Then, compare the new rosinstall file to the old version to see which packages will be updated:

$ diff -u kinetic-desktop_full-wet.rosinstall kinetic-desktop_full-wet.rosinstall.old

If you're satified with these changes, incorporate the new rosinstall file into the workspace and update your workspace:

$ wstool merge -t src kinetic-desktop_full-wet.rosinstall
$ wstool update -t src

Rebuild your workspace

Now that the workspace is up to date with the latest sources, rebuild it:

$ ./src/catkin/bin/catkin_make_isolated --install

If you specified the --install-space option when your workspace initially, you should specify it again when rebuilding your workspace

Once your workspace has been rebuilt, you should source the setup files again:

$ source ~/ros_catkin_ws/install_isolated/setup.bash

2024-11-16 17:51