This is a fully-hermetic Bazel GCC toolchain for Linux that provides cross-compilation support for multiple architectures. The toolchain includes custom-built GCC binaries and sysroots optimized for performance and portability. You can find the comprehensive documentation under docs.
Hermetic toolchains ensure that builds are reproducible across different machines and environments. Without identical headers and libraries, the output produced by Bazel will differ between systems, making C++ caches unsharable and introducing machine-specific bugs that make the development lifecycle unreliable.
When building portable ELF binaries, the libc version plays a crucial role. The linker attempts to link against newer symbols, and GNU libc's symbol versioning means linking against a newer glibc prevents programs from running on systems with older glibc versions. This toolchain ships with glibc 2.26, providing broad compatibility with modern Linux distributions.
The toolchain has been optimized to reduce size and improve build performance through:
Add to your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "gcc_toolchain",
sha256 = "...", # Use the SHA256 of the release
urls = ["https://github.com/f0rmiga/gcc-toolchain/archive/refs/tags/vX.X.X.tar.gz"],
)
load("@gcc_toolchain//toolchain:repositories.bzl", "gcc_toolchain_dependencies")
gcc_toolchain_dependencies()
load("@gcc_toolchain//toolchain:defs.bzl", "gcc_register_toolchain", "ARCHS")
gcc_register_toolchain(
name = "gcc_toolchain_x86_64",
target_arch = ARCHS.x86_64,
)
0.9.2 +8.2mo2026-05-08 | |