Can't run wasm app.

1,783 views
Skip to first unread message

Mark Sibly

unread,
Nov 1, 2016, 10:41:16 PM11/1/16
to emscripten-discuss
Hi,

Ok, got my first wasm app built, but when I tried to visit it via browser I get:

Assertion failed: on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)

Does this mean I need to --preload-file the output file with the .wasm extension when linking?

This I can do, but I'm not sure what 'set on Module['wasmBinary]' involves.

Bye!
Mark

Alon Zakai

unread,
Nov 2, 2016, 1:10:40 AM11/2/16
to emscripten-discuss
Basically, just to assign to Module.wasmBinary (see https://kripken.github.io/emscripten-site/docs/api_reference/module.html ).

Here the issue is we need the wasm binary - it's in a side file with suffix .wasm. You can either load it yourself and assign it to Module.wasmBinary, or you can build to HTML, and emcc will do it all for you.


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Sibly

unread,
Nov 3, 2016, 8:40:22 PM11/3/16
to emscripten-discuss
Thank you, all going now!

Wasm appears to be *amazing* - here's my first wasm app:


In terms of download size, the .wasm file is 1.6M, vs 16.6M for .asm.js!

Source code changes required: 0.

Some questions:

* Is it running native code? If not, will it one day?

* Will wasm support any kind of context switching, eg: fibers? threads?

Congratulations to everyone involved in this, it's a huge achievement!

Bye,
Mark

Mark Sibly

unread,
Nov 3, 2016, 8:47:53 PM11/3/16
to emscripten-discuss
...the only slight bummer is it's only working in nightly. In chrome I get this in the .js file...

Uncaught TypeError: Right-hand side of 'instanceof' is not an object(…)

...here (line 202)...

if (!(Module['wasmMemory'] instanceof WebAssembly.Memory)) {

I *did* strip out the asm.js and .wast files before uploading but I'm guessing that's not it.

On Wednesday, November 2, 2016 at 3:41:16 PM UTC+13, Mark Sibly wrote:

Alon Zakai

unread,
Nov 4, 2016, 1:32:37 PM11/4/16
to emscripten-discuss
* Browsers will usually compile wasm into native code, yes. Much like asm.js, but with more consistency. However, they also may not, for example for fast startup they may interpret for a while first.

* There have been discussions of threads and fibers and such, and there are ideas for how to add them to wasm, but nothing is finalized yet.

Alon Zakai

unread,
Nov 4, 2016, 1:33:35 PM11/4/16
to emscripten-discuss
Is that on latest Chrome Canary?

Derek Schuff

unread,
Nov 4, 2016, 11:27:47 PM11/4/16
to emscripten-discuss

In chrome, wasm isn't enabled by default even on canary; you can enable it from chrome://flags


To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Mark Sibly

unread,
Nov 5, 2016, 2:07:39 AM11/5/16
to emscripte...@googlegroups.com
> Is that on latest Chrome Canary?

Turns out it wasn't - working now with Canary. Got a little confused as 'normal' chrome has an 'enable wasm' flag too, it just doesn't work.

One of my demos appears to be running quite a bit slower in wasm than asm.js though. It's an old school 'voxel engine' that is cpu heavy, so I was expecting it to run faster. Will investigate further...


On Sat, Nov 5, 2016 at 4:27 PM, 'Derek Schuff' via emscripten-discuss <emscripten-discuss@googlegroups.com> wrote:

In chrome, wasm isn't enabled by default even on canary; you can enable it from chrome://flags

On Fri, Nov 4, 2016, 10:33 AM Alon Zakai <alon...@gmail.com> wrote:
Is that on latest Chrome Canary?
On Thu, Nov 3, 2016 at 5:47 PM, Mark Sibly <blitz...@gmail.com> wrote:
...the only slight bummer is it's only working in nightly. In chrome I get this in the .js file...

Uncaught TypeError: Right-hand side of 'instanceof' is not an object(…)

...here (line 202)...

if (!(Module['wasmMemory'] instanceof WebAssembly.Memory)) {

I *did* strip out the asm.js and .wast files before uploading but I'm guessing that's not it.

On Wednesday, November 2, 2016 at 3:41:16 PM UTC+13, Mark Sibly wrote:
Hi,

Ok, got my first wasm app built, but when I tried to visit it via browser I get:

Assertion failed: on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)

Does this mean I need to --preload-file the output file with the .wasm extension when linking?

This I can do, but I'm not sure what 'set on Module['wasmBinary]' involves.

Bye!
Mark

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/v1HxmkigyO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

Mark Sibly

unread,
Nov 5, 2016, 3:17:38 AM11/5/16
to emscripte...@googlegroups.com
Another quick question: Is -s BINARYEN=1 only necessary for the linker, ie: can I use the same .o files for both asm.js and wasm?

Alon Zakai

unread,
Nov 5, 2016, 1:33:51 PM11/5/16
to emscripten-discuss
Yes, the .o files are the same.

To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages