Inferensys

Glossary

Colcon Build Tool

Colcon is the primary command-line build tool for ROS 2, used to compile multiple packages, manage dependencies, and invoke underlying build systems like CMake or Python setuptools.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
ROS 2 BUILD SYSTEM

What is Colcon Build Tool?

Colcon is the primary command-line build tool for the Robot Operating System 2 (ROS 2), designed to build multiple interdependent software packages within a workspace.

The Colcon Build Tool is a Python-based, meta-build system that orchestrates the compilation and installation of multiple packages in a ROS 2 workspace. It does not compile code directly but instead invokes the underlying native build systems—such as CMake for C++ or setuptools for Python—for each package. Its core function is to manage the dependency graph between packages, ensuring they are built in the correct order while providing a unified command-line interface for common operations like building, testing, and listing packages.

Colcon was created as the successor to catkin_make and catkin build from ROS 1, offering improved performance, better handling of mixed build systems, and enhanced user experience through extensible commands and parallel execution. Key features include out-of-source builds, workspace overlaying, and rich output verbosity options. It is the de facto standard for building ROS 2 applications, from simple tutorials to complex, multi-robot systems, and integrates seamlessly with the ROS 2 tooling ecosystem.

ROS 2 BUILD SYSTEM

Key Features of Colcon

Colcon is the de facto build tool for ROS 2, designed to handle the complexities of building multiple interdependent packages from source in a workspace. It abstracts underlying build systems like CMake and Python setuptools, providing a unified, powerful command-line interface.

01

Workspace-Aware Builds

Colcon operates on a workspace—a directory containing source code for multiple ROS packages. Its core function is to build all packages in this workspace while respecting their dependency graph. It automatically determines the correct build order, ensuring dependent packages are built after their dependencies. This is essential for large, modular robotic software stacks where packages rely on messages, services, or libraries from other packages.

02

Build System Abstraction

Colcon is not a build system itself; it is a meta-build tool or build automation tool. It invokes the underlying build system for each package (e.g., CMake for C++, setuptools for Python). It provides a single command (colcon build) that:

  • Detects the build system type for each package.
  • Creates isolated build, install, and log directories (the build/, install/, log/ folders).
  • Handles environment setup, ensuring built packages are added to the local environment via setup scripts.
  • This abstraction allows developers to work with a consistent interface regardless of the package's implementation language.
03

Parallelization and Caching

To accelerate build times, especially for large workspaces, Colcon supports parallel execution. Using the --parallel-workers or --parallel-builds argument, it can build independent packages simultaneously. It also implements intelligent caching: if a package's source code and configuration have not changed since the last successful build, Colcon can skip rebuilding it. This is controlled by the --cmake-clean-first and --symlink-install options, which affect whether builds start from scratch or reuse previous artifacts.

04

Selective Build and Test Commands

Colcon provides fine-grained control over which packages to process:

  • --packages-select: Build only the specified packages.
  • --packages-up-to: Build a package and all of its dependencies.
  • --packages-above: Build a package and all packages that depend on it. This is crucial for iterative development. Similarly, colcon test runs tests for built packages, with options to select specific packages or rerun failed tests. Test results are aggregated in the log/ directory.
05

Environment Overlay (Isolated Installs)

A key feature is the creation of an overlayed environment. When you source install/setup.bash, the built packages' libraries, executables, and ROS 2 message definitions are added to your shell's environment, overlaying on top of any system-wide ROS installation. This allows you to develop and test local changes without affecting other workspaces or the system install. The --symlink-install option creates symlinks instead of copying files, enabling instant changes to Python scripts or launch files without a rebuild.

06

Extensible with Verbose Logging

Colcon is designed for extensibility through plugins and event handlers. Its behavior can be customized for different workflows. It also provides extensive logging:

  • Console output can be controlled with verbosity flags (--event-handlers console_direct+).
  • Detailed build and test logs are written to timestamped directories within log/. This is invaluable for debugging complex build failures, as it captures the exact output from CMake, make, and other underlying tools.
BUILD SYSTEM

How Colcon Works

Colcon is the primary command-line build tool for ROS 2, designed to build multiple interdependent packages within a workspace.

Colcon is a meta-build tool that orchestrates the underlying build systems (like CMake, Python setuptools, or ament) for each package in a workspace. It performs a dependency-aware topological sort to determine the correct build order, then invokes each package's native build process in parallel where possible. The tool aggregates build artifacts into unified install, build, and log directories, providing a consolidated output structure for the entire workspace.

Its operation is driven by a colcon.meta file for workspace-wide configuration and individual package.xml manifests for per-package metadata. Key commands include colcon build for compilation, colcon test for running unit tests, and colcon list to inspect packages. By abstracting the complexities of heterogeneous build systems, Colcon enables developers to manage large, modular robotic codebases with a single, consistent interface.

ROS 2 VS ROS 1

Colcon vs. Catkin: Build Tool Comparison

A technical comparison of the primary build tools for ROS 2 (Colcon) and ROS 1 (Catkin), focusing on architectural differences, features, and workflow.

Feature / MetricColcon (ROS 2)Catkin (ROS 1)

Primary Role

Meta-build tool orchestrating underlying build systems (CMake, Python setuptools)

CMake-based build system with custom macros and Python integration

Core Architecture

Language-agnostic, extensible plugin system for build, test, and other verbs

Tightly integrated CMake workflow with Catkin-specific macros

Workspace Structure

Supports isolated (--merge-install) and merged install layouts; no devel space

Uses devel space for development builds and install space for final deployment

Underlying Build System

Delegates to CMake, ament_cmake, Python setuptools, or other colcon-* plugins

Primarily uses its own Catkin CMake macros; limited direct Python package support

Dependency Management

Processes package dependencies via ament/colcon metadata; parallel builds by default

Processes dependencies via Catkin's CMake macros; sequential builds by default

Build Isolation

High isolation between packages by default; can build subsets of a workspace

Lower isolation; workspace is typically built as a monolithic unit

Test Execution

Integrated test verb with support for multiple test runners; results aggregation

Test execution via catkin_make run_tests or catkin_test_results

Cross-Platform Support

First-class support for Windows, macOS, and Linux

Primarily designed for Linux; limited official support for Windows/macOS

Extensibility

High via plugins (colcon-* packages) for new build types, linters, etc.

Low; extensions require modifying Catkin's core CMake infrastructure

Command-Line Interface

Verb-based (colcon build, colcon test, colcon list). Consistent and extensible.

Make-inspired (catkin_make, catkin_make_isolated, catkin build with catkin_tools).

Real-Time / Production Focus

Designed with production and real-time systems in mind, aligning with ROS 2 goals.

Optimized for the research and prototyping focus of ROS 1.

COLCON BUILD TOOL

Frequently Asked Questions

Colcon is the primary build automation tool for ROS 2 and other ament-based packages. It is the successor to `catkin_make` and `catkin build` from ROS 1. These questions address its core functionality, usage, and integration within the ROS 2 development workflow.

Colcon (Collective Construction) is a command-line tool for building sets of software packages, designed as the primary build system for ROS 2. It works by recursively discovering packages in a workspace, configuring their dependencies, and invoking their underlying native build systems—such as CMake for C++ packages or Python setuptools for Python packages—in the correct topological order. It aggregates the output (build, install, log directories) from all packages into centralized locations, providing a unified interface for compiling, testing, and installing complex, interdependent software stacks like ROS 2.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.