Closed iBicha closed 1 year ago
I don't see why not, in fact I think we already do build it as part of CI: https://github.com/WebAssembly/wabt/blob/e426908d8f0022b13a7ba39725e96fcbe18cb220/.github/workflows/build.yml#L68-L80
I don't see why not, in fact I think we already do build it as part of CI:
Perhaps I need to look closer, but after inspecting the artifacts, I don't see something like wasm-interp.wasm
which is what I'm actually after (similar to https://github.com/wasm3/wasm3/releases/download/v0.5.0/wasm3-wasi.wasm)
I appreciate the guidance! I'm pretty new to wabt
I don't think we public the emscripten build as part of the release. It should be fairly straight forward to build it yourself if you need to.
If you want to create a PR that will stash the CI artifacts somewhere that would be great too (then I think you could download them from any CI run).
What I'm saying is that the github action might not be producing the actual interpreter in wasm.
I ran the build locally, and the produced artifacts look like test artifacts, not wasm-interp.wasm
> find *.wasm
callback.wasm
finalize.wasm
global.wasm
hello.wasm
hostref.wasm
memory.wasm
multi.wasm
reflect.wasm
serialize.wasm
start.wasm
table.wasm
threads.wasm
trap.wasm
Yes those are not the build artifacts. How did you do that build? The build artifacts end up the bin
directory inside the build directory.
I would do something like this:
$ mkdir build
$ cd build
$ emcmake cmake -G Ninja ..
$ ninja wasm-interp
$ node wasm-interp.js
wasm-interp: expected filename argument.
It looks like wabt build to pure JS by default, if you want the wasm version you would need to edit CMakeLists.txt and remove -sWASM=0
. (We should probably remove that).
I followed the CI (docker was nice, since I didn't have to worry about the right deps)
docker run -di --name emscripten -v $(pwd):/src emscripten/emsdk:latest bash
docker exec emscripten emcc -v
docker exec emscripten emcmake cmake .
docker exec emscripten make -j 2 VERBOSE=1
I removed -sWASM=0, but that didn't change the output.
And do you get a wasm-interp.js
file being produced?
BTW, you don't need to use docker, you can also just install emsdk in your machine if you want.
And do you get a
wasm-interp.js
file being produced?
Yes, and I'm trying make it produce wasm-interp.wasm
I dug a bit in the settings, and then changed the extra link flags to
set(EXTRA_LINK_FLAGS
"${EXTRA_LINK_FLAGS} -sSINGLE_FILE -Oz -sSTANDALONE_WASM -sALLOW_MEMORY_GROWTH"
)
But ninja.build
still contains target for wasm-interp.js
, and still produces that file, not the wasm
Oh you have to remove -sSINGLE_FILE
too since otherwise it embeds the wasm
inside the JS.
BTW do you really want to the wasm file or do you just want to run it on the web (in which case you probably want to the JS file too).
Oh you have to remove
-sSINGLE_FILE
too since otherwise it embeds thewasm
inside the JS.BTW do you really want to the wasm file or do you just want to run it on the web (in which case you probably want to the JS file too).
I will try removing the SINGLE_FILE flag and see!
Yeah sorry for leaving an important detail (related to the ticket I mentioned) I do not have a js runtime. What I have is a tool that is capable of transforming wasm into brightscript. But the transformed code has limitations. So I was hoping I can built wasm-interp into wasm, transform that into brightscript, and use it to load other wasm modules, bringing functionality to Roku OS apps.
Yup, removing SINGLE_FILE produces the wasm module! I will close this issue, since this is a very niche thing, so I doubt someone would need to build into wasm specifically. Thank you for the guidance @sbc100
Can wasm-interp be built for wasm? Solving for https://github.com/WebAssembly/binaryen/issues/5530