Marc
01/15/2023, 11:15 PM1.8.20-dev-5802
. I managed to get it working in that I get an .mjs file and a .wasm file, but when I try to execute the .mjs file with Node 19.4.0 with a completely empty main function, the execution fails with the following message:
CompileError: WebAssembly.Module(): Compiling function #13:"kotlin.text.checkRadix" failed: Invalid opcode 0xe3 @+9238
When I try to open the produced file in an online WASM to WAT converter, it also fails. How can there be an invalid opcode? Am I missing any flags that I have to enable in Node? I am currently using --experimental-wasm-eh
, --experimental-wasm-typed-funcref
and --experimental-wasm-gc
. From what I have seen after a quick Google search, the opcode 0xe3 doesn't seem to be valid currently anyways, not even when considering all active proposals.sdeleuze
01/16/2023, 6:33 AMNVM_NODEJS_ORG_MIRROR=<https://nodejs.org/download/v8-canary> nvm install v20.0.0-v8-canary202212266b2b946a63
nvm use v20.0.0-v8-canary202212266b2b946a63
And/or configure your build like https://github.com/skuzmich/kotlin-wasi-bindings-experiments/blob/main/build.gradle.ktsMarc
01/16/2023, 12:13 PMsdeleuze
01/16/2023, 12:40 PMSvyatoslav Kuzmich [JB]
01/16/2023, 12:44 PMInstead of designing your Kotlin programs to use these WASI calls, would be maybe be possible to compile a WASM program normally and replace the JS glue code with WASI calls from within the WASM executable, preferrably also written in Kotlin? That would require the names of those imported JS functions to be stable of course, which they don’t really look like they are...At some point, would would likely have a version of stdlib without JS, with WASI imports only.
sdeleuze
01/16/2023, 12:57 PMMarc
01/16/2023, 2:16 PMI am not sure what is your use case for what you describe for WASI, could you ellaborate?I am trying to compile a standalone WASM binary that I can run externally without any JS glue, which seems like is not really currently possible... But that's why I am asking if there are any ugly hacks to do it anyways 😄
Svyatoslav Kuzmich [JB]
01/16/2023, 2:49 PMsdeleuze
01/16/2023, 2:51 PMMarc
01/16/2023, 3:22 PMsdeleuze
01/16/2023, 3:23 PMMarc
01/16/2023, 3:28 PMsdeleuze
01/16/2023, 3:31 PMMarc
01/16/2023, 3:38 PMSvyatoslav Kuzmich [JB]
01/16/2023, 5:19 PMMarc
01/16/2023, 6:22 PMpreopens
configuration section somehow but what exactly are you supposed to write there? I tried putting IP addresses with and without ports in there but all I get are UVWASI_ENOENT
errors.sdeleuze
01/17/2023, 2:22 PMMarc
01/17/2023, 2:38 PM