Stream: git-wasmtime

Topic: wasmtime / Issue #1763 Unable to run AssemblyScript WASI


view this post on Zulip Wasmtime GitHub notifications bot (May 26 2020 at 22:23):

okalousek opened Issue #1763:

I have tried some assemblyscript projects with WASI, but no one worked with wasmtime. All od these are working fine on wasmer.
It showes me error with something Is not a function

https://github.com/torch2424/wasm-matrix

https://github.com/shonenada/hash-wasm

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 14:13):

alexcrichton commented on Issue #1763:

Thanks for the report! Would you be able to provide us with some reproduction steps? For example what wasm modules were you working with? How did you execute them? (etc)

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 20:14):

okalousek commented on Issue #1763:

Just downloaded these from issue links. Wasm-matrix have prebuild WASMs and hash-wasm i had to compile myself. I did not do anything special with compilation. Only runned build.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 20:14):

okalousek edited a comment on Issue #1763:

Just downloaded these from issue links. Wasm-matrix have prebuild WASMs and hash-wasm i had to compile myself. I did not do anything special with compilation. Only runned build.
I have executed by: wasmtime buildedname.wasm

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 20:21):

sunfishcode commented on Issue #1763:

The "matrix" example is known to use ANSI-style escape codes to draw character graphics, and Wasmtime doesn't currently support this, because unrestricted use of ANSI-style escape codes creates a variety of security concerns (eg. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000523). We are currently working on a design which allows us to support escape sequences while ensuring security.

Could you post the error message you see when you run hash-wasm?

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 20:23):

okalousek commented on Issue #1763:

$ wasmtime hash.wasm
Error: failed to run main module `hash.wasm`

Caused by:
    0: failed to instantiate "hash.wasm"
    1: command export '__rtti_base' is not a function

view this post on Zulip Wasmtime GitHub notifications bot (May 28 2020 at 10:58):

bjorn3 commented on Issue #1763:

__rtti_base is part of the AssemblyScript runtime. Wasmtime doesn't allow any exported globals other than a few specific ones:

view this post on Zulip Wasmtime GitHub notifications bot (May 28 2020 at 10:58):

bjorn3 edited a comment on Issue #1763:

__rtti_base is part of the AssemblyScript runtime. Wasmtime doesn't allow any exported globals other than a few specific ones:

https://github.com/bytecodealliance/wasmtime/blob/3715e19c67ab7e59fadf750a1de2ba48f1e6f4ce/crates/wasmtime/src/linker.rs#L448

view this post on Zulip Wasmtime GitHub notifications bot (May 28 2020 at 17:46):

torch2424 commented on Issue #1763:

Hello! @pchickey brought this to my attention :smile:

@bjorn3 is correct in that looks like an export from AS runtime :smile: Though, If I understand correctly, a WASI module can have multiple exports correct? Is that a Wasmtime issue than?

@okalousek in the meantime, you could compile your AssemblyScript with --runtime half, as that won't export anything that is from the runtime.

And wasm-matrix is a really old AS WASI example of mine (it doesn't use the runtime, it uses the old allocators directly). I've been working on some WASI examples for WasmByExample. As the AS WASI story is a lot better now, especially in very recently released 0.10.0 :smile:

view this post on Zulip Wasmtime GitHub notifications bot (May 28 2020 at 17:57):

torch2424 commented on Issue #1763:

And I went ahead and made a quick hello world example: https://github.com/torch2424/as-playground/tree/master/wasi-hello-world . Take a look at the package.json, it shows how I am using --runtime half with the compiler, to work around this for now. Also, I provided a binary as well @okalousek if you want to test it quickly :smile:

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 01:02):

sunfishcode commented on Issue #1763:

AssemblyScript programs are now fixed, as of #1773. Use of --runtime half is recommended for command-style programs like this, though not strictly required (for now). Thanks for your help everyone!

I've also now collected the information here into a document showing how to run AssemblyScript programs in Wasmtime:

https://bytecodealliance.github.io/wasmtime/wasm-assemblyscript.html

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 01:02):

sunfishcode closed Issue #1763:

I have tried some assemblyscript projects with WASI, but no one worked with wasmtime. All od these are working fine on wasmer.
It showes me error with something Is not a function

https://github.com/torch2424/wasm-matrix

https://github.com/shonenada/hash-wasm

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 23:44):

torch2424 commented on Issue #1763:

Yay! Thank you @sunfishcode ! :smile:


Last updated: Nov 22 2024 at 17:03 UTC