[Documentation] [TitleIndex] [WordIndex

Installing from source

Install from source requires that you download and compile the source code on your own. ROS Noetic supports Ubuntu Focal and Debian Buster, but other platforms are possible. The target platforms are defined in REP 3

Prerequisites

Installing bootstrap dependencies

Install bootstrap dependencies (Ubuntu):

These tools are used to facilitate the download and management of ROS packages and their dependencies, among other things.

Ubuntu or Debian:

Fedora:

Generic (pip):

Initializing rosdep

$ sudo rosdep init
$ rosdep update

Installation

Start by building the core ROS packages.

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 download the source code for ROS packages so we can build them. We will use vcstool for this. For the purpose of this guide, we'll assume you'd like to build all of Desktop.

This will download all of the source code for packages part of Desktop into the ~/ros_catkin_ws/src directory. The command will take a few minutes to download everything.

Looking for something other than Desktop? More variants are defined in REP 150 such as desktop_full, robot, perception, etc. Just change the package path above from desktop to the one you want.

Resolving Dependencies

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

rosdep looks at all the packages in the src directory and tries to find and install their dependencies on your platform. After a while (and maybe some prompts for your password) rosdep will finish installing system dependencies and you can continue.

Building the catkin Workspace

By now you have a workspace with all of the source code, and all required system dependencies have been installed. Now it's time to build the code. ROS 1 packages use CMake; however, calling cmake by hand on all the packages by hand would be tedious. There are tools we can use to build all the packages in the right order. The tool we'll use is catkin_make_isolated.

catkin_make_isolated isn't the only tool we could use. There are other tools that would work, like catkin_make or catkin_tools (which has a command line executable called catkin), or colcon. Some of those might be better for your use case, but we'll use catkin_make_isolated here since that's what the ROS buildfarm uses.

This command will build everything in the workspace. It may take a while. The command is running catkin_make_isolated command from the source folder because it has not been installed yet. Once installed it can be called using just catkin_make_isolated.

Note: If you see an error relating to the EMPY module being missing you may be building using Python 2 rather than Python 3. To ensure you are using the latter, append the the following to the command above. If you have Python 3 installed elsewhere, update the path accordingly.

-DPYTHON_EXECUTABLE=/usr/bin/python3

Note: Want debug symbols? You might want to select a different CMake build type.

When the above command finishes, it will have installed everything into ~/ros_catkin_ws/install_isolated. If you would like to install somewhere else then add --install-space path/to/somewhere/else to the catkin_make_isolated call.

For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/noetic just as the Ubuntu packages would do. Of course, don't do this in Ubuntu, as the packages would collide with apt-get packages.

Now the packages should have been installed to ~/ros_catkin_ws/install_isolated 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 like so:

Maintaining a Source Checkout

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

Update your rosinstall file

To update your workspace, first move your existing rosinstall file so that it doesn't get overwritten, and generate an updated version

$ mv -i noetic-desktop.rosinstall noetic-desktop.rosinstall.old
$ rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall

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

$ diff -u noetic-desktop.rosinstall noetic-desktop.rosinstall.old

Download the latest sources

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

$ vcs import --input noetic-desktop.rosinstall ./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-09-28 14:22