Brussels / 3 & 4 February 2024

schedule

Build Distribution for Maintaining the Famous GCC 4.7


Many GNU Linux distributions start their own bootstrap process with a set of binary seeds. Because, how do you build a modern C/C++ compiler without a C/C++ compiler? To solve this chicken-and-egg problem, an approach taken by some distributions is to rely on opaque, pre-build binaries. However, in order to increase trustworthiness in software, we should be able to produce every part of it from source, or at least reduce the size of the initial binary seed to the absolute minimum.

In the bootstrappable builds movement, the GCC version 4.7 plays an important role: it is the last GCC version that can be built with only a C compiler. Therefore, this compiler is a stepping stone for bootstrapping everything that relies on the C++ language and above. Another important metric for trustworthiness is the capability to build reproducibly, independently of the build directory, which we addressed with patches, as it is not a native feature of this compiler version. Furthermore, additional patches were required for bringing this compiler version up to date, i.e., adding support for more recent C libraries (e.g., the musl libc) and for obtaining a compiler installation that works independently of its install prefix.

We would like to present a build description (for the JustBuild build system), used to patch and bootstrap a GCC version 4.7 on a minimal x86_64 Linux system, which only needs a POSIX shell, coreutils, and a C library (GNU, musl) installed. To achieve this, the bootstrap process starts by building Busybox, GNU Make, and Binutils from scratch before those are used to bootstrap GCC 4.7. We can furthermore show how that compiler can then be used to bootstrap additional build tools (Make, CMake, Python) and even the most recent compilers (GCC 13.2, Clang 17), all from source on the exact same minimal system. In doing so, we basically bootstrap an extremely minimalistic Linux distribution for building compiler toolchains. All of that is strictly defined within a single JustBuild project, which is publicly available under an open-source license at: https://github.com/just-buildsystem/bootstrappable-toolchain.

Speakers

Photo of Oliver Reiche Oliver Reiche

Attachments

Links