Skip to content

Commit c3edb61

Browse files
committed
fix: remove duplicate target specification causing rustc conflicts
Fix "Option 'target' given more than once" error by: 1. Remove manual --target specification from rustc_flags in rust_wasm_component.bzl. Rules_rust handles target selection automatically based on configured target triples in MODULE.bazel. 2. Remove problematic aliases in wasm_toolchain.bzl that were causing dependency cycles. Use *_binary targets directly instead. The duplicate target specification was conflicting with clippy configuration, causing CI build failures. Let rules_rust handle cross-compilation to WASM targets properly through the platform selection mechanism.
1 parent c01818b commit c3edb61

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

.claude/settings.local.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(find:*)",
5+
"Bash(bazel build:*)",
6+
"Bash(bazel:*)",
7+
"mcp__sequential-thinking__sequentialthinking",
8+
"Bash(ls:*)"
9+
],
10+
"deny": []
11+
}
12+
}

MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/rust_wasm_component.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ def rust_wasm_component(
165165
# Build the Rust library as cdylib for this profile
166166
rust_library_name = "{}_wasm_lib_{}".format(name, profile)
167167

168-
profile_rustc_flags = rustc_flags + config["rustc_flags"] + [
169-
"--target=" + WASM_TARGET_TRIPLE,
170-
]
168+
profile_rustc_flags = rustc_flags + config["rustc_flags"]
171169

172170
rust_library(
173171
name = rust_library_name,

toolchains/wasm_toolchain.bzl

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,8 @@ alias(
263263
visibility = ["//visibility:public"],
264264
)
265265
266-
# Aliases for backward compatibility
267-
alias(
268-
name = "wasm-tools",
269-
actual = ":wasm_tools_binary",
270-
visibility = ["//visibility:public"],
271-
)
272-
273-
alias(
274-
name = "wac",
275-
actual = ":wac_binary",
276-
visibility = ["//visibility:public"],
277-
)
278-
279-
alias(
280-
name = "wit-bindgen",
281-
actual = ":wit_bindgen_binary",
282-
visibility = ["//visibility:public"],
283-
)
266+
# Note: Aliases removed to prevent dependency cycles
267+
# Use the _binary targets directly: wasm_tools_binary, wac_binary, wit_bindgen_binary
284268
""")
285269

286270
wasm_toolchain_repository = repository_rule(

0 commit comments

Comments
 (0)