Skip to content

build failed when converting .rs to .wasm #900

Closed
@SimonWang9610

Description

@SimonWang9610

🐛 Bug description

When I followed the official document Rust and WebAssembly and coded the example Conway's Game of Life, I failed to run wasm-pack build. Error Message as below:

Fatal: error in validating input
Error: failed to execute ``wasm-opt``: exited with exit code: 1
full command: "C:\\Users\\Simon\\AppData\\Local\\.wasm-pack\\wasm-opt-171374efd61df962\\wasm-opt.exe" "C:\\projects\\learn-rust\\wasm-game-of-life\\pkg\\wasm_game_of_life_bg.wasm" "-o" "C:\\projects\\learn-rust\\wasm-game-of-life\\pkg\\wasm_game_of_life_bg.wasm-opt.wasm" "-O" To disable ``wasm-opt``, add ``wasm-opt = false`` to your package metadata in your ``Cargo.toml.`

Even though I disabled wasm-opt = false, the compiled process was passed but it failed to work with the glue code. I mean, run npm run start it did not work as expected.

the Rust code is the same as the example in the Doc Rust and WebAssembly.

🤔 Expected Behavior

I want to know it is a bug? or something wrong I did?
I am totally a beginner on Rust & WebAssembly, hope you guys can help me.

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: wasm-pack 0.9.1
rustc version: rustc 1.45.0 (5c1f21c3b 2020-07-13)
wee_alloc version: 0.4.5
wasm-bindgen version: 0.2.63
opt-level: 's'

Platform: Windows 10
IDE: VS code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existswasm-opt

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions