Skip to content

Conversation

@helly25
Copy link
Collaborator

@helly25 helly25 commented Mar 15, 2025

See issue #473

This builds on PR #471

This PR allows requirements support for the LLVM versions like llvm_version = "first" and llvm_version = "latest" which will effectively find the first and latest LLVM version respectively. For many people this will be the easiest way to get started and solves the issue that not always all arch/os versions have been prepared for all LLVM versions. It also means you do not have to know whether the basename starts with "LLVM" or "clang_llvm", in which order arch and os have to be provided and how the os is exactly specified.

We further add the ability to specify requirements, including minimum and maximum versions as well as version exclusions. That can be easier than figuring out which versions are available for which platform. Further this allows to automatically pick up relevant versions automatically as they become available later. Example:

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True)
llvm.toolchain(
    name = "llvm_toolchain_llvm",
    llvm_version = "latest:>=19.1.6,!=19.1.7,!=20.1.0",
)
use_repo(llvm, "llvm_toolchain_llvm")

The requirements strings mostly follow semver specs and support <, <=, >, >=, == and !=. They only currently work for version components major, minor and patch. Since we do not list other versions in our config that is fine for now.

One practical goal for this PR is to be able to run automatic tests with updated LLVM versions in the easiest possible way. Using the new extra_llvm_versions we can now easily run automated CI/CD tests against different LLVM branches. Say:

  • llvm_version = 'latest:>=15,<16'
  • llvm_version = 'latest:>=19,<20'
  • llvm_version = 'latest:>=20,<21'
    That above list would be used in three separate CI/CD runs that would then test the 15, 19 and 20 branches respectively. When new distributions get added upstream or locally, they can easily be added via the new extra_llvm_distributions and will be picked up by the setup without any further change.

@helly25
Copy link
Collaborator Author

helly25 commented May 12, 2025

@fmeum this is ready from my end now, I'd appreciate any feedback. I added a concrete practical goal to the PR description.

@helly25 helly25 force-pushed the feat/latest_requirements branch from f983ee3 to 5467126 Compare May 16, 2025 16:01
@helly25 helly25 force-pushed the feat/latest_requirements branch from 09b2483 to 9dd9631 Compare June 5, 2025 12:44
helly25 added 18 commits June 5, 2025 13:59
Add a test for the distribution finder.
The test computes what would be found given all versions a nd a combination of arch and os.
Then the test compares the result to what is configured and shows the difference.
If the difference is empty then the finder is correct.
There are currently only deleted entries with the last deleted enty in version 18.1.0.
In other words starting with llvm version 18.1.1 the finder is correct.
That also means as long as this is true, when someone adds information for a new version then the test does not need to be updated.
This allows to specifically require ranges, including minimum and maximum versions as well as version exclusions.
That can be easier than figuring out which versions are available for which platform.
Further this allows to automatically pick up relevant versions automatically as they become available later.
…at is not setup correctly. Since it s going away there is also no point in adding and fixing it now.
Need to upgrade external helly25_bzl to 0.1.2 to fix its workspace file.
Also important: Add the strip_prefix. Otherwise the workspaces dump the repo including the root directory. As a result the files cannot be found and BAzel only states there is no BUILD file. It should possibly suggest there is no such directory and no such bzl file in the first place.
Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me after a quick read through. I'm also fine with the new dep that handles version parsing.

Could you resolve the conflict and perform the cleanup you had in mind? Then I can do a full review.

helly25 and others added 23 commits September 28, 2025 12:28
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[rules_foreign_cc](https://redirect.github.com/bazel-contrib/rules_foreign_cc)
| bazel_dep | minor | `0.13.0` -> `0.15.0` |
|
[rules_foreign_cc](https://redirect.github.com/bazelbuild/rules_foreign_cc)
| http_archive | minor | `0.13.0` -> `0.15.1` |

---

### Release Notes

<details>
<summary>bazel-contrib/rules_foreign_cc (rules_foreign_cc)</summary>

###
[`v0.15.0`](https://redirect.github.com/bazel-contrib/rules_foreign_cc/releases/tag/0.15.0)

[Compare
Source](https://redirect.github.com/bazel-contrib/rules_foreign_cc/compare/0.14.0...0.15.0)

#### Using Bzlmod

1. Enable with `common --enable_bzlmod` in `.bazelrc`.
2. Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_foreign_cc", version = "0.15.0")
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE.bazel` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_foreign_cc",
    sha256 = "92bf237df47776ef5127506234135a48de939b57553c253097b632726d881a7d",
    strip_prefix = "rules_foreign_cc-0.15.0",
    url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.15.0/rules_foreign_cc-0.15.0.tar.gz",
)

load("@&#8203;rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

### This sets up some common toolchains for building targets. For more details, please see
### https://bazel-contrib.github.io/rules_foreign_cc/0.15.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

### If you're not already using bazel_skylib, bazel_features or rules_python,
### you'll need to add these calls as well.

load("@&#8203;bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@&#8203;bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@&#8203;com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

```

#### What's Changed

- Improve flags handling for meson by
[@&#8203;mering](https://redirect.github.com/mering) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1303](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1303)03
- cmake: put CMAKE\_SYSTEM\_{NAME,PROCESSOR} into toolchain file by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1365](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1365)65
- win: fix proper EXT\_BUILD\_ROOT in PATH by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1358](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1358)58
- fix sysroot for make and pkgconfig built tools by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1356](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1356)56
- bzlmod: prevent extension from registering repos by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1374](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1374)74
- add xcompile support for ppc64le for autotools and cmake by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1373](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1373)73
- feat: support make vars in postfix\_script by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1375](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1375)75
- Allow cmake to use pkg-config for dependencies by
[@&#8203;chouquette](https://redirect.github.com/chouquette) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1370](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1370)70
- chore(ci): Add arm64 tests for root module by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1378](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1378)78
- add a static\_suffix attr by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1372](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1372)72
- chore(deps): Update libpng by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1377](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1377)77
- chore(deps): Update rules\_python to 1.2.0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1380](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1380)80
- chore(deps): Update rules\_perl by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1381](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1381)81
- use string.removesuffix by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1382](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1382)82
- Add shellcheck tests for generated build scripts by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1390](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1390)90
- Absolutize paths beginning with `bazel-out/` by
[@&#8203;allsey87](https://redirect.github.com/allsey87) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1392](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1392)92
- Add support for Emscripten by
[@&#8203;allsey87](https://redirect.github.com/allsey87) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1383](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1383)83
- chore: update cmake versions by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1399](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1399)99
- feat: meson additional targets by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1385](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1385)85
- fix: allow rules to consume tools env data by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1397](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1397)97
- fix: broken msvc builds by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1400](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1400)00
- fix: Update apr / apr-util versions to fix CI by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1402](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1402)02
- chore: Bump min OS in CI as Ubuntu 20.04 is now EOL by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1408](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1408)08
- chore: Seperate platform specific shellcheck tests by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1409](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1409)09
- chore: Update openssl version to latest of the 1.1.1 series by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1410](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1410)10
- fix: full\_label by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1404](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1404)04
- chore: Update default version of cmake to last of the 3.x series by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1411](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1411)11
- Release 0.15.0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1412](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1412)12

#### New Contributors

- [@&#8203;mering](https://redirect.github.com/mering) made their first
contribution in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1303](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1303)03
- [@&#8203;chouquette](https://redirect.github.com/chouquette) made
their first contribution in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1370](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1370)70

**Full Changelog**:
https://github.com/bazel-contrib/rules\_foreign\_cc/compare/0.14.0...0.15.0

###
[`v0.14.0`](https://redirect.github.com/bazel-contrib/rules_foreign_cc/releases/tag/0.14.0)

[Compare
Source](https://redirect.github.com/bazel-contrib/rules_foreign_cc/compare/0.13.0...0.14.0)

#### Using Bzlmod

1. Enable with `common --enable_bzlmod` in `.bazelrc`.
2. Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE.bazel` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_foreign_cc",
    sha256 = "e0f0ebb1a2223c99a904a565e62aa285bf1d1a8aeda22d10ea2127591624866c",
    strip_prefix = "rules_foreign_cc-0.14.0",
    url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.14.0/rules_foreign_cc-0.14.0.tar.gz",
)

load("@&#8203;rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

### This sets up some common toolchains for building targets. For more details, please see
### https://bazel-contrib.github.io/rules_foreign_cc/0.14.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

### If you're not already using bazel_skylib, bazel_features or rules_python,
### you'll need to add these calls as well.

load("@&#8203;bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@&#8203;bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

```

#### What's Changed

- Pin Bazel version back to 7.4.1 by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1350](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1350)50
- Added README describing toolchain patches by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1349](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1349)49
- fix: `pyc` files in Meson `mesonbuild` repo causing rebuilds by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1343](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1343)43
- Added formatting checks for C/C++ and python code by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1348](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1348)48
- fix: CMAKE\_MODULE\_LINKER\_FLAGS\_INIT breaks macos builds by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1344](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1344)44
- Simplify docs by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1351](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1351)51
- Added rust example by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1354](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1354)54
- framework: avoid forced path suffixing by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1346](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1346)46
- Upgrade rules\_python to version 1.1.0-rc0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1355](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1355)55
- Move protobuf to a dev dependency by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1363](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1363)63
- add cmake configuration attr by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1339](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1339)39
- Release 0.14.0 by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1364](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1364)64

**Full Changelog**:
https://github.com/bazel-contrib/rules\_foreign\_cc/compare/0.13.0...0.14.0

</details>

<details>
<summary>bazelbuild/rules_foreign_cc (rules_foreign_cc)</summary>

###
[`v0.15.1`](https://redirect.github.com/bazel-contrib/rules_foreign_cc/releases/tag/0.15.1)

[Compare
Source](https://redirect.github.com/bazelbuild/rules_foreign_cc/compare/0.15.0...0.15.1)

#### Using Bzlmod

1. Enable with `common --enable_bzlmod` in `.bazelrc`.
2. Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE.bazel` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_foreign_cc",
    sha256 = "32759728913c376ba45b0116869b71b68b1c2ebf8f2bcf7b41222bc07b773d73",
    strip_prefix = "rules_foreign_cc-0.15.1",
    url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.15.1/rules_foreign_cc-0.15.1.tar.gz",
)

load("@&#8203;rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

### This sets up some common toolchains for building targets. For more details, please see
### https://bazel-contrib.github.io/rules_foreign_cc/0.15.1/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

### If you're not already using bazel_skylib, bazel_features or rules_python,
### you'll need to add these calls as well.

load("@&#8203;bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@&#8203;bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@&#8203;com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

```

#### What's Changed

- Update zlib version by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1413](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1413)13
- Mark extension as reproducible by
[@&#8203;fmeum](https://redirect.github.com/fmeum) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1416](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1416)16
- chore(deps): Latest versions of cmake and ninja by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1419](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1419)19
- fix: remove system dependency on python3 by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1415](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1415)15
- fix: fix make\_build.bzl for macos. by
[@&#8203;H5-O5](https://redirect.github.com/H5-O5) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1422](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1422)22
- docs: Update instructions for WORKSPACE by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1423](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1423)23
- Release 0.15.1 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1424](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1424)24

#### New Contributors

- [@&#8203;H5-O5](https://redirect.github.com/H5-O5) made their first
contribution in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1422](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1422)22

**Full Changelog**:
https://github.com/bazel-contrib/rules\_foreign\_cc/compare/0.15.0...0.15.1

###
[`v0.15.0`](https://redirect.github.com/bazel-contrib/rules_foreign_cc/releases/tag/0.15.0)

[Compare
Source](https://redirect.github.com/bazelbuild/rules_foreign_cc/compare/0.14.0...0.15.0)

#### Using Bzlmod

1. Enable with `common --enable_bzlmod` in `.bazelrc`.
2. Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_foreign_cc", version = "0.15.0")
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE.bazel` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_foreign_cc",
    sha256 = "92bf237df47776ef5127506234135a48de939b57553c253097b632726d881a7d",
    strip_prefix = "rules_foreign_cc-0.15.0",
    url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.15.0/rules_foreign_cc-0.15.0.tar.gz",
)

load("@&#8203;rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

### This sets up some common toolchains for building targets. For more details, please see
### https://bazel-contrib.github.io/rules_foreign_cc/0.15.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

### If you're not already using bazel_skylib, bazel_features or rules_python,
### you'll need to add these calls as well.

load("@&#8203;bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@&#8203;bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@&#8203;com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

```

#### What's Changed

- Improve flags handling for meson by
[@&#8203;mering](https://redirect.github.com/mering) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1303](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1303)03
- cmake: put CMAKE\_SYSTEM\_{NAME,PROCESSOR} into toolchain file by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1365](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1365)65
- win: fix proper EXT\_BUILD\_ROOT in PATH by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1358](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1358)58
- fix sysroot for make and pkgconfig built tools by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1356](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1356)56
- bzlmod: prevent extension from registering repos by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1374](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1374)74
- add xcompile support for ppc64le for autotools and cmake by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1373](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1373)73
- feat: support make vars in postfix\_script by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1375](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1375)75
- Allow cmake to use pkg-config for dependencies by
[@&#8203;chouquette](https://redirect.github.com/chouquette) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1370](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1370)70
- chore(ci): Add arm64 tests for root module by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1378](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1378)78
- add a static\_suffix attr by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1372](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1372)72
- chore(deps): Update libpng by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1377](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1377)77
- chore(deps): Update rules\_python to 1.2.0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1380](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1380)80
- chore(deps): Update rules\_perl by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1381](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1381)81
- use string.removesuffix by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1382](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1382)82
- Add shellcheck tests for generated build scripts by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1390](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1390)90
- Absolutize paths beginning with `bazel-out/` by
[@&#8203;allsey87](https://redirect.github.com/allsey87) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1392](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1392)92
- Add support for Emscripten by
[@&#8203;allsey87](https://redirect.github.com/allsey87) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1383](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1383)83
- chore: update cmake versions by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1399](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1399)99
- feat: meson additional targets by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1385](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1385)85
- fix: allow rules to consume tools env data by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1397](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1397)97
- fix: broken msvc builds by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1400](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1400)00
- fix: Update apr / apr-util versions to fix CI by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1402](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1402)02
- chore: Bump min OS in CI as Ubuntu 20.04 is now EOL by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1408](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1408)08
- chore: Seperate platform specific shellcheck tests by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1409](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1409)09
- chore: Update openssl version to latest of the 1.1.1 series by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1410](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1410)10
- fix: full\_label by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1404](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1404)04
- chore: Update default version of cmake to last of the 3.x series by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1411](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1411)11
- Release 0.15.0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1412](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1412)12

#### New Contributors

- [@&#8203;mering](https://redirect.github.com/mering) made their first
contribution in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1303](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1303)03
- [@&#8203;chouquette](https://redirect.github.com/chouquette) made
their first contribution in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1370](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1370)70

**Full Changelog**:
https://github.com/bazel-contrib/rules\_foreign\_cc/compare/0.14.0...0.15.0

###
[`v0.14.0`](https://redirect.github.com/bazel-contrib/rules_foreign_cc/releases/tag/0.14.0)

[Compare
Source](https://redirect.github.com/bazelbuild/rules_foreign_cc/compare/0.13.0...0.14.0)

#### Using Bzlmod

1. Enable with `common --enable_bzlmod` in `.bazelrc`.
2. Add to your `MODULE.bazel` file:

```starlark
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
```

#### Using WORKSPACE

Paste this snippet into your `WORKSPACE.bazel` file:

```starlark
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_foreign_cc",
    sha256 = "e0f0ebb1a2223c99a904a565e62aa285bf1d1a8aeda22d10ea2127591624866c",
    strip_prefix = "rules_foreign_cc-0.14.0",
    url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.14.0/rules_foreign_cc-0.14.0.tar.gz",
)

load("@&#8203;rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

### This sets up some common toolchains for building targets. For more details, please see
### https://bazel-contrib.github.io/rules_foreign_cc/0.14.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

### If you're not already using bazel_skylib, bazel_features or rules_python,
### you'll need to add these calls as well.

load("@&#8203;bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@&#8203;bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@&#8203;rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

```

#### What's Changed

- Pin Bazel version back to 7.4.1 by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1350](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1350)50
- Added README describing toolchain patches by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1349](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1349)49
- fix: `pyc` files in Meson `mesonbuild` repo causing rebuilds by
[@&#8203;jjmaestro](https://redirect.github.com/jjmaestro) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1343](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1343)43
- Added formatting checks for C/C++ and python code by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1348](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1348)48
- fix: CMAKE\_MODULE\_LINKER\_FLAGS\_INIT breaks macos builds by
[@&#8203;jsun-splunk](https://redirect.github.com/jsun-splunk) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1344](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1344)44
- Simplify docs by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1351](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1351)51
- Added rust example by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1354](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1354)54
- framework: avoid forced path suffixing by
[@&#8203;novas0x2a](https://redirect.github.com/novas0x2a) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1346](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1346)46
- Upgrade rules\_python to version 1.1.0-rc0 by
[@&#8203;jsharpe](https://redirect.github.com/jsharpe) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1355](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1355)55
- Move protobuf to a dev dependency by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1363](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1363)63
- add cmake configuration attr by
[@&#8203;matt-sm](https://redirect.github.com/matt-sm) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1339](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1339)39
- Release 0.14.0 by
[@&#8203;UebelAndre](https://redirect.github.com/UebelAndre) in
[https://github.com/bazel-contrib/rules_foreign_cc/pull/1364](https://redirect.github.com/bazel-contrib/rules_foreign_cc/pull/1364)64

**Full Changelog**:
https://github.com/bazel-contrib/rules\_foreign\_cc/compare/0.13.0...0.14.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/bazel-contrib/toolchains_llvm).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC42Mi4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjIuMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This allows re-using extracted repository contents
(bazelbuild/bazel#12227, see release notes of [Bazel
8.3](https://github.com/bazelbuild/bazel/releases/tag/8.3.0)).
This commit changes the cc_wrapper.sh script to allow for it to find
paths when invoked at runtime with runfiles as apposed to strictly using
build-rule invokes.

fixes bazel-contrib#517 
Work towards buildbuddy-io/bazel_env.bzl#51
May not be contained in all distributions.
This adds support for bare metal riscv32 targets that don't need a
sysroot.

I have an esp32 riscv board that I'm building for, and to set up an
appropriate toolchain, `toolchains_llvm` needs to know about it.
bazel-contrib#515 only makes the config repository reproducible. The downloaded
toolchains are store in a separate repository. Since this separate
repository is not marked as reproducible, the extracted files are
currently not cached.

This change fixes that by marking the repositority that contains the
downloaded toolchain also reproducible.

Similar to the git repo rule here:
https://github.com/bazelbuild/bazel/blob/648f991bd8653408ba6b4c24c6ff8fa4fce51eba/tools/build_defs/repo/git.bzl#L219
In debian:latest (As of August 9th 2025 that is 13 aka "Trixie") there
is no simple way of getting libtinfo5 immediately. So as a quick way to
moving forward we stick to debian:bookworm insteam.

This allows us to proceed with
bazel-contrib#539.

After that we should possibly have separate tests for debian:bookworm
and debian:trixie.
This includes updating and using
bazelbuild/rules_cc@ff06b70 and
bazelbuild/rules_cc@eed7e63
which is also [used by
`bazel_tools`](https://github.com/bazelbuild/bazel/blob/4f46e8265313078b8afbf9d6b832711b2d75cfc2/tools/cpp/unix_cc_toolchain_config.bzl#L17).

Usage example:
```starlark
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
    compile_flags = {
        "fastbuild_compile_flags": [
            "-O1",
        ],
    },
    llvm_version = "20.1.2",
)
```

---------

Co-authored-by: Tom Rybka <[email protected]>
Add more 21.1.0 distributions
@helly25
Copy link
Collaborator Author

helly25 commented Oct 1, 2025

This looks good to me after a quick read through. I'm also fine with the new dep that handles version parsing.

Could you resolve the conflict and perform the cleanup you had in mind? Then I can do a full review.

@fmeum All merged today. Trying to get a green run. Looks like MacOS runners have an allocation problem. Maybe reruns fix that.

@helly25 helly25 requested a review from fmeum October 1, 2025 14:21
@helly25 helly25 merged commit f54b90b into bazel-contrib:master Oct 5, 2025
43 checks passed
@helly25 helly25 deleted the feat/latest_requirements branch October 9, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants