Skip to content

How to produce a .wasm binary? #2546

Answered by akesling
duarten asked this question in Q&A
Mar 10, 2024 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Apologies if this isn't quite the direction you want to go in, but while I don't have experience using rust_shared_library specifically, I do have experience getting Rust Wasm binaries + libraries to build under Bazel. The key is to realize that you need to convince Bazel to apply a platform transition to the build graph. Please take a moment to read the Bazel configuration transition docs for context on what on earth is actually happening here.

I've built a few helpers that make this easier for my project. The core of all of this is a wasm "platform transition":

def _wasm_rust_transition_impl(settings, attr):
    return {
        "//command_line_option:platforms": "@rules_rust//rust/plat…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@akesling
Comment options

@bcmyers
Comment options

@akesling
Comment options

Answer selected by duarten
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants