Skip to content

Intro to Build Systems

What is a Build System

Formally, we can define build systems as:

"a reusable and abstracted system that is used to compile software and assemble other related components (e.g. documentation, samples, installers) that make up a finished software product. The build system defines how the software and other components are assembled, dependencies that need to be satisfied, and third-party components that are used in the build process."

At a higher-level, we can think of build systems as a set of tools, programs, scripts, and methods to consistently and correctly produce the required build artifacts (application binaries, system configuration files, test results, etc).

Given the integration of IDEs and extensible text editors, you wouldn't be blamed for not considering these details. However, the truth is you've probably been using or have encountered build systems without realizing it. For the curious, take you might want to take a look at the Arduino Sketch Build Process.

High Level View

Before detailing the benefits and rationale behind build-systems, we should take a look at the bigger picture.

Let's say you were developing a simple chatroom app that runs on Windows. Without a build system, you as the developer, would be responsible for manually compiling and linking all required artifacts to get a usable application.

Many applications and programs are built using GNU Make and makefiles.

There are many options for build systems which includes but is not limited to:

Build System Description Icon
Meson "Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible. The main design point of Meson is that every moment a developer spends writing or debugging build definitions is a second wasted. So is every second spent waiting for the build system to actually start compiling code."
Bazel "Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users."

Why we should care about build systems

Build systems are not a silver bullet. They will not magically make your application/program/project start working (usually). However, as engineers, not only should we be concerned with what we're doing but how we're doing it. Build systems are a tool to help make development easier, more reliable, and consistent across developers and development teams.

Below are a few reasons or experiences that may convince you to consider learning and or integrating build systems into your next project.

1. Inconsistent Builds

  • The timeless "it works on my machine"
  • Increased likelihood of hidden bugs
  • Missing dependencies are almost guaranteed
    • Your application might not even compile :(

2. Brittle Development

  • Parts of the project tend to break with the slightest breeze!
  • Testing process is not standardized or automated
    • Broken code can be committed without being noticed
  • Hardware may even be required for testing logical parts of the code

3. "Artisanal" Development

  • More of a style convention that build systems helps influence
  • Code is not modular.
    • Too many dependencies in the main codebase
    • Hard to reuse code across multiple projects
      • Leads to re-inventing the wheel

4. Slow Bring-up Time

  • It takes time to get up to speed with new projects especially for new developers
  • It is extremely to get demoralized from a project that fights you at every action.
  • See If They Come, How Will They Build It?

More Developer Woes

  • BTW This is only the tip of the iceberg :)

For embedded software, a lot of care must be taken to ensure application binaries are consistent between developers especially for large/complex projects with multiple developers.