Consumers interact with this repository through the gcc module extension in
@score_bazel_cpp_toolchains//extensions:gcc.bzl.
Typical usage looks like this:
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.4.0")
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc")
gcc.toolchain(
name = "score_gcc_toolchain",
target_cpu = "x86_64",
target_os = "linux",
version = "12.2.0",
use_default_package = True,
)
use_repo(gcc, "score_gcc_toolchain")gcc.toolchain(...)
Declares a toolchain repository to generate.
gcc.sdp(...)
Declares a package repository explicitly. This is used when the package is not taken from the default version matrix or when local QNX SDP generation is required.
Required attributes:
name: name of the generated repositorytarget_cpu: target CPU, currentlyx86_64oraarch64target_os: target OS, currentlylinuxorqnx
Common package selection attributes:
use_default_package: resolve package metadata frompackages/version_matrix.bzlversion: GCC version string for Linux toolchainssdp_version: QNX SDP version stringsdk_version: alternative SDK identifier used in matrix resolutionsdp_to_link: override the package repository name that the toolchain uses
Flag and runtime attributes:
extra_compile_flagsextra_c_compile_flagsextra_cxx_compile_flagsextra_link_flagsld_library_pathsruntime_ecosystemuse_base_constraints_only
QNX-specific attributes:
license_pathlicense_info_variablelicense_info_url
The gcc.sdp tag defines the package side of the toolchain setup. Important
attributes are:
name: repository name for the packagebuild_file: BUILD file that exposes the package contents as Bazel targetsurl: url of the archive,sha256: sha256 of the archivestrip_prefix: extraction prefix for packaged archives
Declaring a toolchain repository is not enough on its own. Consumers still need to activate the generated toolchain during Bazel analysis, typically with a configuration such as:
--extra_toolchains=@score_gcc_toolchain//:x86_64-linux-gcc_12.2.0
The example workspace under examples/ provides complete .bazelrc
configurations for this activation step.
- The extension is intended for the root module.
- When
use_default_packageis enabled, the version matrix can inject extra include and link flags required by non-standard sysroot layouts. - QNX toolchains use additional licensing and include-path parameters that do not apply to Linux toolchains.