Using bzlmod with Bazel 6 or later:
-
[Bazel 6] Add
common --enable_bzlmodto.bazelrc. -
Add to your
MODULE.bazelfile:
bazel_dep(name = "rules_cc", version = "0.2.25")Using WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_cc",
sha256 = "bd7124a844d0403b4b353bcea34d6c8b2ba88dc26881c26c9ee668da89b71846",
strip_prefix = "rules_cc-0.2.25",
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.2.25/rules_cc-0.2.25.tar.gz",
)
load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")
compatibility_proxy_repo()What's Changed
Notable changes
- Throw an error if include attributes contain an absolute path instead of silently ignoring them. by @a-googler in c85b4d3
- Disable macOS toolchain by default (use apple_support instead) by @keith in 0c36f2b
- Allow 'includes = ["."]' in the root of the repo by @keith in 0d150d5
- Add //cc/libc config settings for C standard libraries (#792) by @fmeum in dc42405
- Add best effort toolchain feature docs by @keith in 2c27663
- Add loongarch64 support by @zhaixiaojuan in 5178408
- Support path mapping in CppLink IFF it's non-lto. by @lilygorsheneva in ad214a9
- Create features to enable/disable path mapping for CppLink. by @lilygorsheneva in ab613e1
- Add toolchain env + default env to dwp actions by @keith in d8eea5a
- Fix system_include_paths with textual_hdrs/hdrs and strip_include_prefix by @keith in db79849
- Expose Bazel cc rule functions for extension by @hvadehra in 6c6a87e
- Expand tree artifacts in textual_hdrs in generated module maps (#787) by @fmeum in 6cc1bf0
- Honor object extensions for ThinLTO merged artifacts (#853) by @cerisier in aff5441
- Expose a new API that copying from an existing library with overrides, so that callers don't need to know all internal attributes to avoid silently dropping some. by @a-googler in 14686ad
- Implement Starlark-level enforcement of disallowed compiler flags in copts, conlyopts, cxxopts. by @a-googler in f687cbc
- Move coverage script / flag to public package (#867) by @keith in 661b75d
- Support C++20 modules, GCC part by @PikachuHyA in faf2113
- Fix conflicting actions for C++20 modules info files in PIC/non-PIC b… (#834) by @PikachuHyA in 7b711b6
- Support C++20 modules, MSVC part (#836) by @PikachuHyA in de72c61
Default toolchain changes
- Add Clang -ftime-trace support to rules_cc (#772) by @PikachuHyA in 84cca09
- Make grep_includes a public attribute (#838) by @keith in bb9acd6
- Add -z origin to bsd linkopts (#855) by @keith in b1771c1
- Add missing bsd link libraries (#859) by @keith in 2c06f12
- Remove bsd support from unix_cc_configure (use bsd toolchain instead) (#860) by @keith in 813b9bd
- Fix VS2026 being passed an unsupported debug flag in -c fastbuild by @robinlinden in c7abbec
- Fix incorrect compiler type with
USE_CLANG_CLon windows. (#858) by @UebelAndre in 1d2e4cb - Pass fission flags to ThinLTO backend actions (#837) by @akonradi in 5bcfcf7
Rules based toolchain changes
- Support C++20 modules in the rules-based toolchain API by @fmeum in 0be22af
- Fix another case of tool_paths vs action configs by @keith in 736fa13
- Add
ACTION_NAMES.cpp_header_analysistoALL_CPP_COMPILE_ACTION_NAMES. by @anforowicz in 6c1531c - Default cc_sysroot data to sysroot if not passed (#875) by @keith in 3000380
Full Changelog: 0.2.22...0.2.25