Add missing rustc binaries to rustc_lib filegroup#3727
Add missing rustc binaries to rustc_lib filegroup#3727avrabe wants to merge 2 commits intobazelbuild:mainfrom
Conversation
738871d to
b715cc7
Compare
Testing PR bazelbuild/rules_rust#3727 which adds wasm-component-ld.exe and rust-objcopy.exe to rustc_lib filegroup. This should fix Windows wasm32-wasip2 builds by ensuring the linker is copied into the Bazel sandbox. Issue: avrabe/rules_rust#8
Testing PR bazelbuild/rules_rust#3727 which adds wasm-component-ld.exe and rust-objcopy.exe to rustc_lib filegroup. This should fix Windows wasm32-wasip2 builds by ensuring the linker is copied into the Bazel sandbox. Issue: avrabe/rules_rust#8
b715cc7 to
030a4cf
Compare
030a4cf to
2b63294
Compare
|
@illicitonion is there anything which prevents this to be merged? this change is useful for macos as well #3307 |
UebelAndre
left a comment
There was a problem hiding this comment.
There's now a rust-lld target which has at least wasm-component-ld as a runfile. I think this is a better home for that but don't know exactly where objcopy should go. What about it's own filegroup and adding it as it's own optional attribute to rustc_toolchain?
I agree with you that it would be good to be a separate attribute of the toolchain for objcopy. It would simplify some parts as we have some custom rules for stripping targets. Unless @avrabe would do it. I could contribute that change. |
I'd be happy to review that from whoever wanted to put up the PR 😄 |
2b63294 to
3563a3d
Compare
|
Thanks for the feedback @UebelAndre - updated the approach:
@havasd thanks for the offer to contribute - I went ahead and made the changes. Hope this looks better now. |
3563a3d to
1720224
Compare
PR #3727 (bazelbuild/rules_rust#3727) is still open in upstream rules_rust. The previous commit incorrectly removed the fork override, breaking Windows builds. The fork at avrabe/rules_rust includes the fix that adds wasm-component-ld.exe to the rustc_lib filegroup, which is required for Windows WASM component builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Override rules_rust 0.68.1 with fork that fixes the bug where target_files parameter was ignored in _symlink_sysroot_tree. This ensures wasm-component-ld is symlinked into the sysroot, fixing Windows builds for wasm32-wasip2 targets. See: bazelbuild/rules_rust#3727 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f34108f to
c30cafc
Compare
|
Updated with additional fixes for Commit 1: Add Commit 2: Fix sysroot construction for linker tools
These fixes enable |
PR #3727 (bazelbuild/rules_rust#3727) is still open in upstream rules_rust. The previous commit incorrectly removed the fork override, breaking Windows builds. The fork at avrabe/rules_rust includes the fix that adds wasm-component-ld.exe to the rustc_lib filegroup, which is required for Windows WASM component builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Override rules_rust 0.68.1 with fork that fixes the bug where target_files parameter was ignored in _symlink_sysroot_tree. This ensures wasm-component-ld is symlinked into the sysroot, fixing Windows builds for wasm32-wasip2 targets. See: bazelbuild/rules_rust#3727 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7ae12cf to
e25e6cb
Compare
Adds `rust-objcopy` as a separate filegroup and optional attribute on `rust_toolchain`, following the same pattern as `rust-lld`. The filegroup is only generated when rust-objcopy is available (Rust 1.84.0+).
- Use target_files parameter instead of target.files in loop
- Place linker at lib/rustlib/{triple}/bin/ so rustc's PATH includes it
Fixes wasm-component-ld failing to find rust-lld on Windows.
Head branch was pushed to by a user without write access
e6d2f0e to
1241b83
Compare
|
Hi @UebelAndre - I think I accidentally disabled auto-merge when rebasing. All CI is green and I've addressed your feedback. Could you re-enable auto-merge or re-review when you get a chance? Thanks! |
Summary
Add
rust-objcopyandwasm-component-ldto therustc_libfilegroup inrepository_utils.bzl. These binaries are present in recent rustc distributions (wasm-component-ld since 1.82.0, rust-objcopy since 1.84.0) but were not previously declared.Changes
rust-objcopy{binary_ext}andwasm-component-ld{binary_ext}to the rustc_lib filegroup glob patternsContext
On Windows, Bazel copies files into the sandbox rather than symlinking, so only explicitly listed files are available. This caused wasm32-wasip2 builds to fail with
linker 'wasm-component-ld.exe' not found.On Linux/macOS, the issue was masked by symlink-based sandboxing which allowed rustc to access unlisted files in the same directory.