Wasm-pack: Error while packing

Created on 14 Jun 2018  ·  3Comments  ·  Source: rustwasm/wasm-pack

rustc --version 
rustc 1.28.0-nightly (b68432d56 2018-06-12)
wasm-pack init
| [2/9] 🎯  Adding WASM target...
| [3/9] 🌀  Compiling to WASM...
| ⛔   [ERR]: There was an error while calling another CLI tool. Details:
Compilation of your program failed. stderr:

   Compiling unicode-xid v0.1.0
   Compiling serde v1.0.66
   Compiling wasm-bindgen-shared v0.2.11
   Compiling dtoa v0.4.2
   Compiling itoa v0.4.1
   Compiling proc-macro2 v0.4.6
   Compiling quote v0.6.3
   Compiling syn v0.14.2
   Compiling serde_json v1.0.20
   Compiling serde_derive v1.0.66
   Compiling wasm-bindgen-backend v0.2.11
   Compiling wasm-bindgen-macro v0.2.11
   Compiling wasm-bindgen v0.2.11
   Compiling hellowasm v0.1.0 (file:///Users/marcos/temp/rust/hellowasm)
error[E0658]: attribute procedural macros are experimental (see issue #38356)
 --> 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

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

warning: unused import: `wasm_bindgen::prelude::*`
 --> src/lib.rs:5:5
  |
5 | use wasm_bindgen::prelude::*;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `hellowasm`.

To learn more, run the command again with --verbose.

Most helpful comment

@marcoscaceres i backchanneled the story to @mgattozzi he didn't realize that i had asked you to file :)

All 3 comments

It seems like you're code doesn't have the right features turned on! It's a quick fix!

Make sure this #![feature(proc_macro, wasm_import_module, wasm_custom_section)] is at the top of your src/lib.rs file. If you look at the help section of the error messages it also suggests to add that, but wasm-pack also needs the two wasm features turned on as well.

If that doesn't fix your issue please reopen this again and I'll be more than happy to figure out with you what might have gone wrong :smile:

I misspelled “macro” ... because my name is marcos

@marcoscaceres i backchanneled the story to @mgattozzi he didn't realize that i had asked you to file :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ishitatsuyuki picture ishitatsuyuki  ·  5Comments

netgusto picture netgusto  ·  4Comments

rbtcollins picture rbtcollins  ·  3Comments

turboladen picture turboladen  ·  4Comments

Outpox picture Outpox  ·  4Comments