Repository navigation
Don't link libresolv by default on Darwin/MacOS - #4326
Merged
Merged
Conversation
dzbarsky
added a commit
to hermeticbuild/rules_rs
that referenced
this pull request
Oct 13, 2026
Remove -lresolv from the macOS stdlib_linkflags in declare_rustc_toolchains. Rust standard libraries no longer need libresolv on macOS, so this allows toolchains without libresolv to link Rust binaries. Keep the existing iOS link flags, matching bazelbuild/rules_rust#4326.
This fixes compatibility with toolchains that don't ship a libresolv (e.g hermetic_cc_toolchain from Uber). rules_rust currently forces '-lresolv' for a rust stdlib that hasn't needed it for several years. For context, see rust-lang/rust#102766 and bazelbuild#2611 .
UebelAndre
enabled auto-merge
October 22, 2026 19:26
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Nov 18, 2026
Upgrades `rules_rust` from 0.74.0 to [0.75.0](https://github.com/bazelbuild/rules_rust/releases/tag/0.75.0), the latest release. ## Changes - **`bazel/rust.MODULE.bazel`**: version bump. BCR's `rules_rust/0.75.0` has no patches of its own, and `rules_rust` is still depended on only by the root module (`bazel mod explain rules_rust`). - **`bazel/rules_rust_static_runtime.patch`**: content unchanged. Only the `index` lines and hunk positions are regenerated, so the patch applies to the 0.75.0 release tarball with zero fuzz and zero offset (the old one applied with offsets of up to 102 lines). The patch is still needed, because 0.75.0 still links the *dynamic* C++ runtime into dylib/cdylib crates. It also still chooses the runtime in exactly the three places the patch routes through `cc_runtime_libs` (`collect_inputs`, `_add_native_link_flags`, and rustdoc's doc-test link flags). Unlike the last bump, no new selection site appeared that the patch would miss. - **`Cargo.Bazel.json.lock`**: repinned with `./bin/bazel-pin.sh --force`. Only the `checksum` changes, since it covers the `cargo-bazel` version. The generated crate graph is identical. - **Four Rust files, via the Autofix commit**: whitespace-only, see below. ## Formatting changes from the Autofix commit We don't set `rustfmt_version`, so `bazel run :rustfmt`, which CI's Autofix job runs, uses rules_rust's default nightly rustfmt. 0.75.0 moves that from `nightly/2026-08-20` to `nightly/2026-10-15` (rustfmt 1.11.0-nightly). The newer nightly indents `*` continuation lines that start at column 0 in block comments by one space, aligning them under the `*` of `/*`. Autofix applied that to four files in 82449b5, and all 50 changed lines differ only by that one space. Without this commit, every later PR would get the same Autofix commit. Stable `cargo fmt -- --check` (rustfmt 1.10.0-stable, which `ci/scripts/rust-lint.sh` runs) passes on the result, so the two formatters still agree. ## Upstream changes that touch our setup - **The rustc 1.99.1 toolchain downloads are now checksum-verified.** 0.74.0's built-in `known_shas.bzl` has no 1.99.x entries and we pass no `sha256s` to `rust.toolchain`, so those archives were fetched with an empty `sha256`. 0.75.0 ships their checksums ([bazelbuild/rules_rust#4311](bazelbuild/rules_rust#4311)). - [bazelbuild/rules_rust#4347](bazelbuild/rules_rust#4347) declares the C++ toolchain type through rules_cc's `use_cc_toolchain()`. With our rules_cc 0.2.22 that is `@bazel_tools//tools/cpp:toolchain_type`, the same type the hermetic-llvm wrapper toolchains in `//bazel` register under. This needed checking because rules_rust requests that type with `mandatory = False`, so a mismatch would silently resolve no C++ toolchain instead of failing. - [bazelbuild/rules_rust#4339](bazelbuild/rules_rust#4339) adds a `cargo_toolchain`, and `cargo_build_script` now fails when the Cargo and Rust toolchains come from different releases. The `rust` extension registers a matching `cargo_toolchain` next to every `rust_toolchain`, and we register only 1.99.1, so the two can't disagree. - [bazelbuild/rules_rust#4271](bazelbuild/rules_rust#4271) changes how legacy doc tests map paths into runfiles: the writer now strips the root of every action input. That replaces the explicit runtime-lib handling our hermetic-llvm doc-test links relied on. The runtime libs still reach those inputs through the patched `collect_inputs`, so they stay covered. - [bazelbuild/rules_rust#4326](bazelbuild/rules_rust#4326) drops `-lresolv` from the default macOS link flags. No first-party code calls resolver functions; the macOS CI jobs cover third-party crates. ## Verification - `bazel build //... --nobuild`: all 3387 targets analyze. - `//rs/ic_os/networking/nss_icos`, our only `rust_shared_library` and the case the patch exists for, links the static LLVM libunwind. Its `_Unwind_*` symbols are defined locally, and every undefined dynamic symbol is a versioned glibc one. - All 60 non-manual `rust_doc_test` targets pass. - These build: `//rs/replica`, `//rs/orchestrator`, `//rs/pocket_ic_server:pocket-ic-server`, `//rs/canister_sandbox`, the NNS governance and ICRC-1 ledger canisters (wasm), `//:rustfmt` and `//:gen_rust_project`. - CI covers the full build and test suite. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: IDX GitHub Automation <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes compatibility with toolchains that don't ship a libresolv (e.g hermetic_cc_toolchain from Uber). rules_rust currently forces '-lresolv' for a rust stdlib that hasn't needed it for several years. For context, see rust-lang/rust#102766 and #2611 .