Build Systems &
Build Tools

Why use something beyond CMake

What are the differences between catkin and ament

Feb. 9th 2017
Dirk Thomas

Main Benefits



Meta
information

CMake config file
generation

Environment
setup

Build / test / package
multiple packages

Meta Information

  • Machine readable meta information
    • Package name and version
    • Maintainer name and email, licenses
    • Dependencies
    • Links to source, doc, issues
    • Arbitrary additional information in the export section

  •   → Automation, automation, and automation
    • Use dependencies to determine topological order
    • Name, version, maintainers and licenses
      are required for the packaging process
    • Use links to guide users
    • E.g. export plugin information

For more details see REP 140.

CMake config file generation (just for convenience)

  • In order for find_package(foo) to work
    • You need to have a CMake config file (or module)
    • By convention it should set the following variables:
      • foo_FOUND, foo_VERSION(_...)
      • foo_INCLUDE_DIRECTORIES
      • foo_LIBRARIES (abs. paths or library names)
      • foo_LIBRARY_DIR (if the prev. one contains names)
  • Naming Conventions
    • Possible file names (see find_package() docs):
      • <name>Config.cmake
      • <lower-case-name>-config.cmake
    • Existing CMake config files are written inconsistently, you don't know which case the set variable names will have
      • ROS uses the second pattern and ensures that all of the following are lower case: find_package() name, filename, variable prefix.

Environment Setup

  • After building and installing packages you might need to
    set / extend environment variables in order to use the software:
    • Prepend / append a path to PATH to find executables
      in non-standard locations
    • Set the PYTHONPATH to find Python modules
      in non-standard locations
    • Set application specific information,
      e.g. GAZEBO_MODEL_PATH, ROSDISTRO_NAME
    • Source e.g. a Bash script for completion functionality

  • The goal:
    • Source a single file which takes care of "everything"

Automation

  • Instead of reading the README of each package and execute the steps manually for each package in topological order...

  • Build all package in ROS Kinetic with 5 (!) lines:
    • Get the code:
      • rosinstall_generator
      • wstool / vcstool
    • Install dependencies:
      • rosdep install
    • Build a workspace of packages:
      • catkin_make(_isolated) / catkin build / ament build / ?
    • Source single file:
      • . setup.bash

  • The ROS buildfarm basically uses the same steps.

Build System vs. Build Tool

Build system Build tool
Operate on a single package a set of packages
Invoking E.g. python setup.py install
or
cmake, make, make install
the build system
for each package
in topological order
In ROS 1 catkin, CMake catkin_make(_iso.) [catkin],
catkin build [catkin_tools]
In ROS 2 ament_cmake, CMake, Python ament build [ament_tools]
Alternative Manifest still required,
man. gen. CMake config,
environment setup??
Build each package manually
  • Any build tool should be able to support any build system,
  • but that is currently not the case 😞

Build Systems: catkin vs. ament

catkin ament_cmake
Platform support Linux, MacOS,
Windows 😜
Linux, MacOS,
Windows
CMake ver. >= 2.8.11 >= 3.5
Devel space
vs.
Symlinks
Devel space is "custom",
pkgs need to work
around spec. issues 😕
Symlinking instead of copying on install is
transparent to the pkg 😉
catkin_basic
vs.
ament_auto
Simplify writing CMake code,
can't handle certain cases "by design", therefore abandoned
Convention
over configuration, may become the "default" 😍
crawling
vs. index
Lots of filesystem crawling 😢 Index built at build time, runtime lookup fast 😍

More Features of both Build Systems

  • Convenience functionality
    • Generation of pkg-config files (only in catkin)
    • CMake functions for gtest / nose tests
    • Download test data
    • CMake variables to simplify target arguments
      (e.g. aggregate include dirs and libraries)

  • Functionality provided by other packages
    • Code generation for ROS messages / services (e.g. genmsg)
    • Support for launch file based ROS tests (rostest)
    • Linter integration to automate checking code style, static code analysis, etc. (ament_lint)

Build Tools:
catkin_make vs. catkin_tools vs. ament_tools

catkin_make(_isolated) catkin_tools ament_tools
Platforms Lin, Mac, Win Lin, Mac, Win Lin, Mac, Win
Python ver. >= 2.7 >= 2.7 >= 3.5

Recommended tool, proven reliability Many great usa­bility features, e.g. config, profile Python pkgs, ROS 2 (only), modularity

No package level parallelization,
tailored to catkin
Not recommended yet, tailored to catkin Almost no usability features
  • We are evaluating options to have one tool merging the best of all,
    maybe even support uses cases like building Gazebo and its dependencies.

Questions...


For more information go to:
wiki.ros.org/catkin/conceptual_overview
design.ros2.org/articles/ament.html