Ok, I basically got it working, but now I want to remove the big polyfill 
and only have pure .wasm support, and I can't get the BINARYEN_METHOD flag 
to work, because python somehow chokes on the '-', and no matter how I want 
to escape the string, I can't get it to work :/

E.g. this is from the dumped linker command:

-s BINARYEN=1 -s BINARYEN_METHOD='native-wasm' -s 
'BINARYEN_SCRIPTS="spidermonkify.py"'

This produces the error:

Traceback (most recent call last):
  File 
"/Users/floh/projects/fips-sdks/osx/emsdk_portable/emscripten/incoming/em++", 
line 13, in <module>
    emcc.run()
  File 
"/Users/floh/projects/fips-sdks/osx/emsdk_portable/emscripten/incoming/emcc.py",
 
line 936, in run
    exec 'shared.Settings.' + key + ' = ' + value in globals(), locals()
  File "<string>", line 1, in <module>
NameError: name 'native' is not defined

Without the BINARYEN_METHOD it works, but produces a 3 MByte big .js file. 

This is on OSX, both in bash and in fish shell. Python version is 2.7.11

Halp :)

(I'll try for now to hack the default in wasm.js-post.js to native-wasm, 
but any idea how to solve that slightly embarrassing problem is welcome :)

Worst case may be: remove the '-' from the binaryen-methods, or replace 
with underscore?

Cheers,
-Floh.

Am Dienstag, 15. März 2016 19:14:41 UTC+1 schrieb Floh:
>
> Thanks! I found the place where the HTML is trying to load the .wasm, so 
> that seems to work (for some reason it injected the absolute path to the 
> .wasm file into the .html, so it would try to do "GET 
> /Users/floh/projects/fips-deploy/oryol/wasm-make-release/Clear.wasm".
>
> With that fixed manually, I now get a magic number mismatch from the .wasm 
> loader (currently testing in Chrome), I guess this is what you mean that it 
> won't work:
>
> Clear.js:88157 Uncaught WASM.instantiateModule(): Result = expected magic 
> word 00 61 73 6d, found 00 80 10 80 @+0
>
> But I think I have enough info now to fix the remaining issues :)
>
> Thanks!
> -Floh.
>
> Am Dienstag, 15. März 2016 19:09:06 UTC+1 schrieb Alon Zakai:
>>
>> Looks like we posted at around the same time :)
>>
>> That .wasm is not going to run in browsers. But it would run in the 
>> binaryen interpreter (veeery slowly). Follow the instructions in the link 
>> to generate a binary that browsers can run. Again, this is annoying now 
>> since the spec is in flux, but it'll get better over the next few months.
>>
>> mappedGlobals is necessary. Wasm lacks globlals, but asm.js has them, so 
>> asm2wasm needs extra metadata, which it places in that file.
>>
>>
>> On Tue, Mar 15, 2016 at 11:07 AM, Floh <[email protected]> wrote:
>>
>>> Ok, seems like I solved the first part, there's a wasm-as tool in 
>>> binaryen which takes a text .wast file and convertes it to a binary .wasm 
>>> file.
>>>
>>> So, 2 remaining questions:
>>>
>>> - how to integrate this .wasm file with the browser module .js file so 
>>> that it is loaded by the browser? (I compiled with emcc -s BINARYEN=1, and 
>>> got a .html and .mem file, plus a .asm.js (which I guess is then converted 
>>> to .wast), a .js file (which I think has the 'runtime environment' and 
>>> polyfill, a .wast file (which I converted to .wasm), and finally a 
>>> .wast.mappedGlobals file). 
>>>
>>> - what about the mappedGlobals file, is this a temporary file, or will 
>>> this be loaded at run-time?
>>>
>>> Thanks :)
>>> -Floh.
>>>
>>> Am Dienstag, 15. März 2016 18:26:37 UTC+1 schrieb Floh:
>>>
>>>> Hi,
>>>>
>>>> I'm currently playing around with binaryen to compile my demos to 
>>>> WebAssembly, but it looks like this can only generate .wast (text) files, 
>>>> is this correct?
>>>>
>>>> Is there a already way to create binary .wasm file with the help of 
>>>> emscripten?
>>>>
>>>> I would *really* like to test my stuff with the new experimental 
>>>> WebAssembly support in Firefox Nightly and Chrome Canary :)
>>>>
>>>> Cheers,
>>>> -Floh.
>>>>
>>> -- 
>>> 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 [email protected].
>>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to