Skip to content

Some experimentation using compiler toolchains in `bazel`.

Notifications You must be signed in to change notification settings

lummax/bazel-gcc-toolchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

load("//toolchain/crosstoolNG_gcc:defs.bzl", "crosstoolNG_toolchain")

crosstoolNG_toolchain(
    name = "gcc_toolchain",
    cxx_flags = ["-std=c++14"],
    sha256 = "...",
    url = "http://.../x86_64-unknown-linux-gnu.tar.bz2",
    variant = "x86_64-unknown-linux-gnu",
    version = "9.5.0",
)

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