Fix wasm staticlib extensions#3968
Conversation
UebelAndre
left a comment
There was a problem hiding this comment.
Thanks! Can you link any documentation that shows .a to be the correct value here? I'm not super familiar with wasm but I haven't heard of a static library being built for wasm. I'd like to avoid picking an arbitrary value so any context will help
Ok here is what I gathered, keep in mind that I am not that familiar with this ruleset or Rust language in general. The Rust Reference describes
and the documented default for The wasm base target options explicitly set executable and dylib-style outputs to exe_suffix: ".wasm".into(), but they do not override staticlib_suffix; they fall through to ..Default::default(), so the staticlib suffix remains rustc’s default The concrete wasm targets are built from those wasm base options. For example:
So my reading is that |
13cf9e6 to
083c89a
Compare
UebelAndre
left a comment
There was a problem hiding this comment.
Thank you for that write-up!
rust_static_librarytargets fail for wasm-style platform mappings whosestaticlib_extis empty.This became visible after #3864 changed the allocator shim target to use
rust_static_library. When building that target for the wasm platform, rules_rust computes:determine_lib_nametreats the empty extension as invalid and fails with:Static library outputs for these wasm/WASI-style targets should use archive output names, e.g. libfoo.a. Binary and dylib outputs can continue using .wasm.
This updates the wasm-style staticlib mappings to .a for:
This is easily reproducible from the rules_rust repository, before this change:
fails during analysis with:
closes #3894