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

The Tutorial seems to be broken #213

Closed
ice-cream-coder opened this issue Jul 13, 2018 · 13 comments
Closed

The Tutorial seems to be broken #213

ice-cream-coder opened this issue Jul 13, 2018 · 13 comments

Comments

@ice-cream-coder
Copy link

After running npm run serve I get this error:

WARNING in ./wasm_game_of_life.js
36:16-38 "export '__wbindgen_malloc' (imported as 'wasm') was not found in './wasm_game_of_life_bg'
 @ ./wasm_game_of_life.js
 @ ./index.js
 @ ./bootstrap.js
 @ multi (webpack)-dev-server/client?http://localhost:8081 ./bootstrap.js

WARNING in ./wasm_game_of_life.js
44:15-25 "export 'greet' (imported as 'wasm') was not found in './wasm_game_of_life_bg'
 @ ./wasm_game_of_life.js
 @ ./index.js
 @ ./bootstrap.js
 @ multi (webpack)-dev-server/client?http://localhost:8081 ./bootstrap.js

WARNING in ./wasm_game_of_life.js
46:8-28 "export '__wbindgen_free' (imported as 'wasm') was not found in './wasm_game_of_life_bg'
 @ ./wasm_game_of_life.js
 @ ./index.js
 @ ./bootstrap.js
 @ multi (webpack)-dev-server/client?http://localhost:8081 ./bootstrap.js

ERROR in chunk 0
0.bootstrap.js
/home/roy/rustproj/wasm_game_of_life/wasm_game_of_life_bg.wasm
Unexpected valtype: 0x61

I inspected my wasm_game_of_lif_bg.wasm and found that all functions were defined. __wbindgen_malloc, greet, and __wbindgen_free.

@scottrblock
Copy link

I'm also receiving the same errors when trying to follow the tutorial. Running on macOS. Happy to provide any other helpful information.

@xtuc
Copy link
Member

xtuc commented Jul 15, 2018

The root of the issue Unexpected valtype: 0x61 comes from https://github.com/xtuc/webassemblyjs, the other errors are from Webpack because we failed to "prepare" the wasm binary.

(I just need to catch my flight and i'll investigate that).

@xtuc
Copy link
Member

xtuc commented Jul 18, 2018

@roydaw could you please send me the repo the tutorial points to? or the tutorial?

@demurgos
Copy link

@xtuc
https://github.com/rustwasm/wasm_game_of_life

But I don't know which chapter has the bug.

@xtuc
Copy link
Member

xtuc commented Jul 18, 2018

I can't reproduce the issue, every chapter of the wasm_game_of_life works for me.

@ice-cream-coder
Copy link
Author

ice-cream-coder commented Jul 18, 2018

I tried to start the tutorial again and got hung up at a different point. I'm trying to follow this page https://rustwasm.github.io/book/game-of-life/setup.html

This time I wasn't able to build the project with npm run build-debug. I get this error:

error[E0658]: attribute procedural macros are experimental (see issue #38356)6   
 --> src/lib.rs:7:1
  |
5 | use wasm_bindgen::prelude::*;
  |     ------------------------ procedural macro imported here
6 | 
7 | #[wasm_bindgen]
  | ^^^^^^^^^^^^^^^
  |
  = help: add #![feature(proc_macro)] to the crate attributes to enable

I checked my lib.rs file and I do have this line:

#![feature(proc_macro, wasm_custom_section, wasm_import_module)]

So I have no idea why it would do that.
(Using Linux, tried npm 5.5.1 and 5.6.0)

@data-pup
Copy link
Member

data-pup commented Jul 18, 2018

Oh shoot, good catch! I think that proc_macro needs to be replaced with use_extern_macros. Not positive that applies here as well, but I ran into a similar issue recently!

@alexcrichton
Copy link
Contributor

@roydaw ah for that @data-pup is correct, and I've submitted an update to the tutorial at rustwasm/book#48

@ice-cream-coder
Copy link
Author

Awesome, I past npm run build-debug now I'm back to my orignal issue.
(Also, someone could look into fixing the compiler error message since it suggested to add proc_macro instead of use_extern_macros.)

@alexcrichton
Copy link
Contributor

@roydaw have you tried updating your NPM dependencies? This may be a fixed bug in webpack perhaps? The compiler suggestion should be fixed in rust-lang/rust#52458

@ice-cream-coder
Copy link
Author

Okay! I ran npm update, and that seemed to fix the issue.

@alexcrichton
Copy link
Contributor

Ok great! In that case sounds like this is fixed now, so closing

fitzgen added a commit to rustwasm/wasm_game_of_life that referenced this issue Jul 18, 2018
@drachehavoc
Copy link

same error here, even after execute npm update.

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

7 participants