LANGUAGES Signal 514 2 feeds carried it
A C++ toolchain from 357 bytes, in Bazel
Illustration only Photo by Olivier Giboulot on Unsplash
A developer has created a Bazel C++ toolchain whose entire build ancestry can be traced to a 357-byte bootstrap seed, enabling Abseil and GoogleTest to be compiled from source within Bazel.
The toolchain provides a fully hermetic C++ build path, reducing dependence on opaque prebuilt binaries and improving reproducibility. By showing that a minimal seed can bootstrap a modern compiler, it offers a practical route for projects that need to port to new architectures or verify build integrity. This approach aligns with the broader goal of making builds more transparent and auditable in open-source ecosystems.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The toolchain starts from a 357-byte program and builds a recent GCC, which then compiles Abseil and GoogleTest without patches.
Hermeticity is verified by a Bazel aspect-based audit report that flags any action executing a program outside the repository’s output tree.
The only remaining external inputs are a shell used by genrule and a small set of seed binaries, highlighting where the bootstrap chain still relies on the host system.
THE READ
What the cluster adds up to.
Stage0 is defined as a chain of compilers and assemblers that can be built from source, beginning with a 357-byte seed program. Once that seed yields a recent GCC, the resulting compiler can be used to build any C or C++ program. This mirrors the strategy adopted by NixOS and other distributions to shrink their binary seed and simplify porting to new architectures.
The author previously attempted to create a stage0-based hermetic C++ toolchain for Bazel in late 2024, making substantial progress but stopping short of usability. By leveraging an LLM to finish the remaining work, the toolchain now supports Bazel’s cc_binary rule and can compile external dependencies directly from the Bazel Central Registry. The setup involves declaring the stage0-bazel dependency and registering the clang and cc toolchains provided by the repository.
To confirm hermeticity, the repository includes an audit report generated via Bazel aspects. The report checks every action in the build graph and fails if any action runs a program not produced by the repository itself. The output shows that all actions are internal except for a few audited seed binaries, namely the hex0 seed and a bash binary used by genrule, which remains an external input because the shell path is not declared as a toolchain input.
Although companies like Google have not made bootstrap seeds a priority, given their control over the entire build environment, the increasing adoption of Bazel and similar build systems in the open-source world creates a need for reproducible, auditable toolchains. This work shows that a minimal seed can scale to a functional C++ toolchain, offering a concrete step toward more transparent and portable builds for the broader community.
Written by elseif from the cluster below · checked for specifics the sources never containedTHE CLUSTER