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
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)
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
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?
$ 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
__rtti_base is part of the AssemblyScript runtime. Wasmtime doesn't allow any exported globals other than a few specific ones:
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:
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:
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
Yay! Thank you @sunfishcode ! :smile:
Most helpful comment
AssemblyScript programs are now fixed, as of #1773. Use of
--runtime halfis 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