Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm rust_library produces bad magic number #298

Open
KaiserKarel opened this issue Mar 11, 2020 · 0 comments
Open

Wasm rust_library produces bad magic number #298

KaiserKarel opened this issue Mar 11, 2020 · 0 comments

Comments

@KaiserKarel
Copy link

Attempting to use rust_wasm_bindgen to cause a transition results in a wasm file with a bad magic number:

error: failed to parse input file as wasm
    caused by: Bad magic number (at offset 0)

My BUILD:

load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
load("@io_bazel_rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")

rust_binary(
    name = "example",
    edition = "2018",
    srcs = [
        "src/main.rs",
    ],
    deps = [
        "//cargo:wasmer_runtime",
    ],
    data = [":wasm_bindgen_bg.wasm"]
)


rust_wasm_bindgen(
    name = "wasm_bindgen",
    wasm_file = ":wasm"
)

rust_library(
    name = "wasm",
    srcs = [
        "wasm/src/lib.rs",
    ],
    edition = "2018",
)

I invoke bazel using bazel build //app:example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant