Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Managing System dependencies
Description: This explains how to use rosdep to install system dependencies.Tutorial Level: INTERMEDIATE
Next Tutorial: Roslaunch tips for large projects
Contents
Show EOL distros:
System Dependencies
ROS packages sometimes require external libraries and tools that must be provided by the operating system. These required libraries and tools are commonly referred to as system dependencies. In some cases these system dependencies are not installed by default. ROS provides a simple tool, rosdep, that is used to download and install system dependencies.
ROS packages must declare that they need these system dependencies in the package manifest. Let's look at the manifest for the turtlesim package:
$ roscd turtlesim
Then,
$ cat package.xml
<package> ... ... <build_depend>message_generation</build_depend> <build_depend>libqt4-dev</build_depend> <build_depend>qt4-qmake</build_depend> <build_depend>rosconsole</build_depend> <build_depend>roscpp</build_depend> <build_depend>roscpp_serialization</build_depend> <build_depend>roslib</build_depend> <build_depend>rostime</build_depend> <build_depend>std_msgs</build_depend> <build_depend>std_srvs</build_depend> </package>
As you can see turtlesim needs those libraries and packages.
$ cat manifest.xml
<package> ... ... <rosdep name="libqt4-dev"/> <rosdep name="qt4-qmake"/> </package>
As you can see turtlesim needs libqt4-dev and qt4-qmake.
$ cat manifest.xml
<package> ... ... <rosdep name="libqt4-dev"/> <rosdep name="qt4-qmake"/> </package>
As you can see turtlesim needs libqt4-dev and qt4-qmake.
rosdep
rosdep is a tool you can use to install system dependencies required by ROS packages.
Usage:
rosdep install [package]
Download and install the system dependencies for turtlesim:
$ rosdep install turtlesim
If you've been following along with the tutorials, it's likely that this is the first time you've used rosdep. When you run this command, you'll get an error message:
ERROR: your rosdep installation has not been initialized yet. Please run: sudo rosdep init rosdep update
Just run those two commands and then try to install turtlesim's dependencies again.
If you installed using binaries you will see:
All required rosdeps installed successfully
Otherwise you will see the output of installing the dependencies of turtlesim:
set -o errexit set -o verbose if [ ! -f /opt/ros/lib/libboost_date_time-gcc42-mt*-1_37.a ] ; then mkdir -p ~/ros/ros-deps cd ~/ros/ros-deps wget --tries=10 http://pr.willowgarage.com/downloads/boost_1_37_0.tar.gz tar xzf boost_1_37_0.tar.gz cd boost_1_37_0 ./configure --prefix=/opt/ros make sudo make install fi if [ ! -f /opt/ros/lib/liblog4cxx.so.10 ] ; then mkdir -p ~/ros/ros-deps cd ~/ros/ros-deps wget --tries=10 http://pr.willowgarage.com/downloads/apache-log4cxx-0.10.0-wg_patched.tar.gz tar xzf apache-log4cxx-0.10.0-wg_patched.tar.gz cd apache-log4cxx-0.10.0 ./configure --prefix=/opt/ros make sudo make install fi
rosdep runs the bash script above and exits when complete.