codetojoy

codetojoy

Programming WebAssembly with Rust: building Rogue WebAssembly game

I’m trying to build the Rogue WebAssembly game from chapter 4, using the code provided on the website.

In build.sh, the wasm-bindgen command is failing with the stack-trace at [1] below. My version of wasm-bindgen is 0.2.67. I have tried changing the Cargo.toml file to “0.2”, instead of “^0.2”, but the result is the same.

thanks!
Michael

p.s. I am enjoying the book, though it might be better to have the code hosted on GitHub?

[1] -

$ wasm-bindgen target/wasm32-unknown-unknown/debug/roguewasm.wasm --out-dir .
thread 'main' panicked at 'remaining data [23]', [SNIP]/wasm-bindgen-cli-support-0.2.67/src/descriptor.rs:109:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: std::panicking::begin_panic_fmt
   8: wasm_bindgen_cli_support::descriptors::execute
   9: wasm_bindgen_cli_support::Bindgen::generate_output
  10: wasm_bindgen_cli_support::Bindgen::generate
  11: wasm_bindgen::main
  12: std::rt::lang_start::{{closure}}
  13: std::rt::lang_start_internal
  14: main

Most Liked

codetojoy

codetojoy

With wonderful help from friends [1], here are steps that enabled the jsint_roguewasm example on my machine:

  • edit index.js to import from ./pkg/roguewasm instead of ./roguewasm
  • edit src/lib.rs to import from ../index instead of ./index
  • in build.sh, replace the wasm-bindgen command with wasm-pack build

[1] - Many thanks to Chris Macrae and Evan Theriault

Popular Community topics Top

New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New