WebAssembly / WASI

WebAssembly System Interface
Other
4.83k stars 251 forks source link

Is WASI already usable on Android? #302

Closed bbigras closed 3 years ago

bbigras commented 4 years ago

Any guides on how to use WASI on Android?

I'm wondering if I could use some python code just like some C lib on Android with WASI.

sbc100 commented 4 years ago

If you just want to run python on android the simplest way would be to simply build cpython for android using NDK.

Compiling cpython to WASI and then building a WASI runtime for android might be possible but it would be a lot more work. Also, many python features would simply not work in WASI due to limits number syscalls available. (e.g. threading, subprocess, ctypes).

bbigras commented 4 years ago

If you just want to run python on android the simplest way would be to simply build cpython for android using NDK.

Gotcha. Thanks!

Also, many python features would simply not work in WASI due to limits number syscalls available. (e.g. threading, subprocess, ctypes).

That's Android limitations right? Would I have those limitations on Linux?

caspervonb commented 4 years ago

That's Android limitations right? Would I have those limitations on Linux?

Limitation of the ABI, we only specify syscalls for filesystem i/o, clocks and some miscellany at this time. Plans for all the other things but as of snapshot_preview1 things like threading, networking etc are not in the spec.

bbigras commented 4 years ago

I see. Thank you very much.

cjihrig commented 4 years ago

FWIW, I believe the wasm3 engine runs on Android with WASI support. I haven't tested it personally though.