Skip to content

[build] Upgrade rules_rs to 0.0.90 and build Rust against @llvm on macOS - #17683

Merged
AutomatedTester merged 1 commit into
trunkfrom
rules_rs_0.00.89
Jun 16, 2026
Merged

[build] Upgrade rules_rs to 0.0.90 and build Rust against @llvm on macOS#17683
AutomatedTester merged 1 commit into
trunkfrom
rules_rs_0.00.89

Conversation

@AutomatedTester

@AutomatedTester AutomatedTester commented Jun 15, 2026

Copy link
Copy Markdown
Member

Description

Upgrades rules_rs from 0.0.61 to 0.0.90 (which also pulls in llvm 0.8.3). The bump surfaces three independent build breakages, fixed here.

1. macOS: error: libtool cannot be used as AR

The newer rules_rust build-script runner rejects an archiver whose name contains libtool. Both the autodetected macOS toolchain and @apple_support (current 2.6.1 hardcodes "ar": libtool) use libtool, so every Rust crate with a build script fails — including the macOS bazel test //rust/... CI job.

Fix: build Rust against the hermetic @llvm toolchain on macOS (archiver = llvm-ar):

  • Register @llvm for macOS exec (aarch64 + x86_64), mirroring the existing Windows registration.
  • On common:macos: BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 + use_libtool_on_macos=False.

2. All platforms: error: cannot derive 'about' from Cargo.toml

clap's #[clap(about)] reads CARGO_PKG_DESCRIPTION at compile time; the newer rules_rust no longer sets it for rust_binary, and the re-resolved clap now hard-errors instead of defaulting to empty.

Fix: set CARGO_PKG_DESCRIPTION via rustc_env on the selenium-manager binary, kept in sync with rust/Cargo.toml.

3. Windows: No matching toolchains found for ...rust:toolchain_type

With llvm 0.8.3 the gnullvm Rust toolchain's target_compatible_with now requires @llvm//constraints/windows/crt:msvcrt. The crt constraint defaults to ucrt, and //:local_windows_gnullvm didn't select one, so nothing matched.

Fix: add @llvm//constraints/windows/crt:msvcrt to the local_windows_gnullvm platform. Also pins llvm to 0.8.3 to match the resolved version (clears the direct-dependency version-skew warning).

Verification

  • macOS (arm64): bazel build //rust:selenium-manager ✅, bazel build //rust/... ✅, bazel test //rust/... ✅ (download tests are network-dependent).
  • Windows fix is verified by toolchain-constraint analysis; it can't be reproduced on a non-Windows host (the platform inherits OS/CPU from @platforms//host). Relying on CI here.

Linux is unaffected.

Checklist

@selenium-ci selenium-ci added the B-build Includes scripting, bazel and CI integrations label Jun 15, 2026
@AutomatedTester AutomatedTester changed the title [build] Upgrade rules_rs to 0.0.89 and build Rust against @llvm on macOS [build] Upgrade rules_rs to 0.0.90 and build Rust against @llvm on macOS Jun 16, 2026
rules_rs 0.0.90 bundles a newer rules_rust and pulls llvm 0.8.3, which
breaks the Selenium Manager build in three ways:

1. The cargo build-script runner now rejects libtool as the archiver
   (AR). macOS C++ toolchains (autodetected and apple_support alike) use
   libtool by default, breaking every Rust crate with a build script.
   Fix: register the hermetic @llvm toolchain for macOS exec (mirroring
   Windows) and, on macOS, disable C++ toolchain autodetection and switch
   the rules_cc archiver from libtool to llvm-ar.

2. The selenium-manager binary fails to compile because clap's
   #[clap(about)] derives the description from CARGO_PKG_DESCRIPTION,
   which rules_rust no longer sets. Fix: set it via rustc_env, kept in
   sync with rust/Cargo.toml.

3. On Windows, no Rust toolchain matches //:local_windows_gnullvm: the
   gnullvm toolchain now requires crt:msvcrt, but the crt constraint
   defaults to ucrt. Fix: select msvcrt explicitly on the platform.

Also pins llvm to 0.8.3 to match the resolved version. Linux is
unaffected.
@AutomatedTester
AutomatedTester merged commit ef8c989 into trunk Jun 16, 2026
63 checks passed
@AutomatedTester
AutomatedTester deleted the rules_rs_0.00.89 branch June 16, 2026 11:01
AutomatedTester added a commit that referenced this pull request Jun 16, 2026
Cross-compiles selenium-manager for every supported OS/arch via rules_rs
platform transitions + the hermetic @llvm toolchain (musl on Linux,
gnullvm on Windows), so release bundles can build all platform binaries
from a single host. Bindings (Java, Python, Ruby, JS, .NET) updated to
probe per-(os, arch) paths from the bundle.

Rebased onto trunk's rules_rs 0.0.90 / @llvm-on-macOS work (#17683).
This was referenced Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants