rules_cc 0.2.20Latest published 6h ago
MODULE.bazel
bazel_dep(name = "rules_cc", version = "0.2.20")
README

C++ rules for Bazel

  • Postsubmit Build status

This repository contains C, C++, and Objective-C language support for the Bazel build system.

For this module's main reference, see the Bazel documentation.

Get Started

Install Bazel

Follow the official instructions to Install Bazel.

Add rules_cc to your MODULE.bazel

Add the latest release to your MODULE.bazel project file.

Declare a build target

In a BUILD.bazel file, import and use the rules:

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
    name = "hello_world",
    srcs = ["hello_world.cc"],
)

Build and run your project

Build and run your C/C++ binary with one command:

$ bazel run hello_world

To build the project without running the binary, use Bazel's build subcommand:

$ bazel build hello_world

Toolchains

Default autoconfigured toolchain

rules_cc includes an auto-configured toolchain that uses the local compiler installed on the host machine.

You can disable the autoconfigured C/C++ toolchain by adding the following Bazel flag to your project's .bazelrc file:

--repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1

Hermetic toolchains

Configuring a hermetic toolchain makes your build more deterministic. rules_cc itself does not yet offer a hermetic toolchain distribution. Other community owned and maintained projects offer hermetic C/C++ toolchains:

Contributing

Bazel and rules_cc are the work of many contributors. We appreciate your help!

To contribute, please read the contribution guidelines: CONTRIBUTING.md.

Note that the rules_cc use the GitHub issue tracker for bug reports and feature requests only. For asking questions see:

About

C++ Rules for Bazel

@bazelbuild/rules_cc@bazelbuild
Homepage
243stars
5:23 PM (6 hours ago)
@bazel-io#9367 rules_cc@0.2.20 (#9367)

Languages

C++4.1%
Shell3.6%
Smarty1.5%
C0.9%
Python0.1%
Batchfile0%
Go Template0%
Linker Script0%

Maintainers

@trybka
@pzembrod

Versions

0.2.20 +21d2026-06-22
0.2.19 +1.3mo1% 272026-06-01
0.2.18 +2.1mo2% 772026-04-21
0.2.17 +2.0mo4% 1872026-02-18
0.2.16 +1d8% 3662025-12-18
0.2.15 +1.4mo1% 282025-12-16
0.2.14 +1d3% 1382025-11-05
0.2.14-rc1 +4d2025-11-03
0.2.13 +11h1% 432025-10-30
0.2.13-rc1 +2d2025-10-29
0.2.12 +1h0% 12025-10-27
0.2.12-rc3 +2d2025-10-27
0.2.12-rc2 +4h2025-10-24
0.2.12-rc1 +3d2025-10-24
0.2.11 +3d0% 112025-10-21
0.2.10 +15d0% 12025-10-17
0.2.9 +20d1% 292025-10-02
0.2.8 +3h3% 1242025-09-12
0.2.7 +<1h2025-09-12
0.2.6 +20h2025-09-12
0.2.5 +2d2025-09-11
0.2.4 +6d21% 9482025-09-08
0.2.3 +4d0% 72025-09-02
0.1.5 +21h1% 352025-08-29
0.2.2 +1d2% 1032025-08-28
0.2.1 +20d0% 152025-08-26
0.2.0 +19d1% 452025-08-06
0.1.4 +2d1% 472025-07-18
0.1.3 +28d3% 1142025-07-15
0.1.2 +4.3mo2% 732025-06-17
0.1.1 +2.6mo13% 5792025-02-07
0.0.17 +8d6% 2682024-11-19
0.0.16 +3d3% 1402024-11-11
0.0.15 +1h1% 402024-11-07
0.1.0 +20h1% 532024-11-07
0.0.14 +27d0% 82024-11-06
0.0.13 +2d1% 662024-10-10
0.0.12 +5h0% 52024-10-07
0.0.11 +23d0% 32024-10-07
0.0.10 +12.0mo2% 722024-09-13
0.0.9 +2.0mo13% 5992023-09-20
0.0.8 +5.1mo1% 642023-07-21
0.0.6 +4d2% 892023-02-17
0.0.5 +24d0% 42023-02-12
0.0.4 +4.1mo0% 12023-01-19
0.0.2 +11.5mo2% 932022-09-19
0.0.11% 412021-10-07