nelhage /rules_boost

bazel build rules to use boost in bazel projects

★ 299⑂ 233👁 14⑃ 523● 100▤ 0
C++Apache-2.0Created 2016-08-14
+0
Daily
+0
Weekly
299
stars
233
forks
14
watchers
523
prs
100
issues
0
releases

README

rules_boost -- Bazel build rules for Boost

 NOTE: Most parts of rules_boost have been migrated to the Bazel Central Registry.

Instead of using rules_boost, consider making use of the Boost packages in the Bazel Central Registry (BCR). 

Among other advantages, the BCR supports using different Boost versions, while rules_boost always only supports one specific Boost version.

If a certain Boost library or version is missing you can make a "module wanted" request in the BCR issue tracker.

This repository remains for compatibility for users who predate BCR, and as a reference for a few the missing parts that have not been migrated to BCR so far. The work in this repository contributed towards the Boost packaging efforts in BCR, but it is now considered legacy and new users are recommended to migrate to BCR. If you are interested in contributing to the Bazel Boost support effort consider, invest your time in the BCR approach instead of this repository.

 Using rules_boost

Copy this into your Bazel MODULE.bazel file to add this repo as an external dependency, making sure to update to the latest commit per the instructions below.

Starlark

 Boost
 Famous C++ library that has given rise to many new additions to the C++ Standard Library
 Makes @boost available for use: For example, add @boost//:algorithm to your deps.
 For more, see https://github.com/nelhage/rules_boost and https://www.boost.org
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
archive_override(
    module_name = "rules_boost",
    urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"],
    strip_prefix = "rules_boost-master",
     It is recommended to edit the above URL and the below sha256 to point to a specific version of this repository.
     integrity = "sha256-...",
)

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
use_repo(
    non_module_boost_repositories,
    "boost",
)


You can now use libraries in deps through the @boost repository, for example @boost//:algorithm.

 If you're using the Apple or Android-specific rules...

As with all platform-dependent C/C++ in Bazel, you'll need to use Bazel 7+ (and a similarly recent version of rules_apple) for per-platform configuration to work automatically out of the box. (Please file a PR to delete this section if Bazel 7 is now so old as to be standard.)

 Suggestion: Updates

Improvements come frequently to the underlying libraries, including security patches, so we'd recommend keeping up-to-date.

We'd strongly recommend you set up Renovate (or similar) at some point to keep this dependency (and others) up-to-date by default. [We aren't affiliated with Renovate or anything, but we think it's awesome. It watches for new versions and sends you PRs for review or automated testing. It's free and easy to set up. It's been astoundingly useful in our codebase, and we've worked with the wonderful

Top issues

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON