Skip to content

Some experimentation using compiler toolchains in `bazel`.

Notifications You must be signed in to change notification settings

lummax/bazel-gcc-toolchain

Repository files navigation

Experiments with Bazel GCC compilation toolchains

This repository is some experimentation with using different gcc compiler toolchains.

Predefined Toolchains

This repository configures toolchains provided by https://toolchains.bootlin.com/ in bazel.

  • All x86_64 toolchains bootlin provides are available. Run bazel query '//external:*' | grep gcc_toolchain for the full list.
  • Additionally some convenience aliases are defined. See bazel query 'kind(toolchain, @gcc_toolchain//...)'.

Custom Toolchains

In case the bootlin toolchains are not sufficient you can build your own using https://crosstool-ng.github.io/. See util/ct-ng/README.md for some help on that.

There is a snippet in MODULE.bazel that can be enabled to use the custom toolchain.

Background Info

Chosen Toolchain

  • https://toolchains.bootlin.com/
    • Provides a wide variation of GCC toolchains for different architectures. Includes various versions of GCC. But might limit the glibc compatiblitily to something new-ish.

Alternative GCC Distributions

Related Bazel Toolchains