Hi guys, grabbed repo, created a CMakefiles.txt.
Get this : https://pastebin.com/t80r554J
Stuck as there appears to be no wasm-micro-runtime\core\shared\platform windows subdir with the file its looking for.
noob to the system. help :)
unsure where I should set WAMR_RUNTIME_LIB_SOURCE to
looks like I need to set WAMR_BUILD_PLATFORM to something but to build on windows, what ? as stated, the file its looking for isn't in the tree as far as I can see.
you build this on windows normally or I'm doing something new ?
It indeed seems that there is no windows support yet. https://github.com/bytecodealliance/wasm-micro-runtime/blob/master/doc/port_wamr.md describes how to port WAMR though if you want to try it yourself.
mmmmkay :) thanks bjorn3. as wasm is in browsers & browsers run on windows that's surprising. suppose firefox & chrome use different runtimes.
can you offer any insight ? I'm wanting a wasm runtime to add to our 3D web browser to replace .net runtime & mono. thought maybe this was a good choice. then again maybe its not. unsure.
@Steve Williams you could look into another one of our projects, Wasmtime, which works on Windows (and macOS, Linux, and some other systems) and is optimized for embedding.
hi till, I spotted wasmtime but wasn't sure what it was. does it also have an embedding API. wanting something close to mono's native interface binding. spotted this for micro-runtime. does wasmtime have similar ? thanks for your assistance.
https://github.com/bytecodealliance/wasm-micro-runtime/blob/master/doc/embed_wamr.md
It does, yes. See the documentation for a few existing embeddings, and the C embedding API here: https://github.com/bytecodealliance/wasmtime#language-support
think we have a winner - cheers :)
time to experiment. update when I have something.
We also have support for debugging of the Wasm code with gdb/lldb, which often helps a lot with figuring out what's going wrong in embedding scenarios. Sadly no Visual Studio debugger, because that requires a completely different debug info format, but Visual Studio Code works, for example
yeah, spotted the lldb stuff. looking forwards to having that running in vr :) so you can debug your 3d stuff right alongside it. not sure if gimmick or genuinely useful at this point - guess we'll see :)
interesting we can use visual studio code for more traditional debugging. visual studio proper has got too big & bulky anyway. for all use cases. asking webdevs to install gigabytes to debug a basic script is one of the reasons for junking our .net assembly approach.
input appreciated & project sounds great. time to dive in :)
Great! I'd love to hear how things are going, whether you run into issues or everything goes smoothly :slight_smile:
back with questions if I get stuck :)
k, installed wasmtime windows installer. it installs wasmtime.exe . no library to build against for embedding applications such as ours. having binary library & header files in that install would eliminate a pain point. so installer no use at this point, guess its back to git repo & figure out how to build what I need. ideally that would have come later. experiment first, build from scratch later is my prefered development path.
For embedding wasmtime, you might wanna check out these two crates:
I don't do crates :) can I not get a zip with .lib & .h in it :) suppose I have to figure out this weird system.
ewwww rust. this stuff has to go fast. not sold its the way.
don't much care what you do under the hood. if you can get it fast in rust, fine. but I'm a straight c++ guy. I want a library and header files. the end.
hate rust syntax so not going there myself.
Oh, right. So I reckon you should checkout the repo (with the submodule) and specifically look into c-api, wasm-c-api, and wasmtime C-headers here
hahaha, I'm exactly the opposite, used to code a lot in C++ and now can't look at it. Rust is so much more readable for me :D
Anyhow, I'll try to help out here but I'm not an expert in embedding Wasmtime in other languages but Rust
thanks. the bit I don't currently understand is where the library my c/c++ program links against is. a .lib file on windows.
happy to build myself. ideally from a script or cmake in the root so I don't have to learn a new system.
or ideally, the binary library would be in the windows installer, along with a simple embedding example I can build & run to verify all is ok before proceeding with development.
do I use rust build thingies to get me a library I can link to from C/C++ ?
confused. not seeing an on ramp here.
thus far I've got build v8 as that defines wasm-c-api, but that's not wasmtime, its the v8 runtime with all its javascript stuff too.
mozilla also have an implementation. am happy to try yours. if there's a piece of the puzzle I need that isn't ready yet, I can shelf this for a while.
I think this is what you're looking for then: wasmtime-v0.15.0-x86_64-windows-c-api.zip :-)
This archive contains both headers and static/dynamic libs
I think it comes with both .lib
and .dll
but you might want to verify me here :-)
oh you rock, Jakub :) thanks so much :)
anytime!
lemme know how you're getting on! I'll do my best to help out the best I can!
looks to be both static & dynamic linked versions there - perfect. is there also a 32 bit equivalent ? thinking of dropping our 32 bit support but I'd like that to be optional rather than forced.
Hmm, I don't think we have 32bit versions. For that, I think you'd need to build it yourself, although I wonder if it'd build just fine.
looks to be 64 bit only prebuilt for now. guess we're running 64 bit :)
https://github.com/bytecodealliance/wasmtime/releases/tag/v0.15.0
32 bit has its advantages as pointers are half the size so caching better, but whatever. lets get something running.
cheers :)
will work with what you have pre-built for now. if I like it, I can put the effort into how to build as I need. your 64 bit only distribution is fine for now.
many thanks.
No probs! I don't have Windows handy ATM, but if you were able to build wasmtime
from sources, I could supply you with build commands to specifically build the embedding libs
happy to work from pre-built for now. that lets me figure out how cool you are :)
32bit support in Cranelift is a bit lacking. @whitequark did open a few PRs to improve this though.
this seems out of date.
https://bytecodealliance.github.io/wasmtime/examples-c-hello-world.html
wasmtime_error_t * seems to have changed to bool
fixing up as I go. comments here in case I anticipate incorrectly. feel free to bash me with the stupid stick :)
not just minor, that sample's out of date. will see if I can figure it out but should be fixed up as this is for us noobs who are confused enough as it is :)
or wasmtime-v0.15.0-x86_64-windows-c-api is out of date & we need a package update. don't know which as new to the code :)
bjorn3: 32 bit support not critical right now. for now looking to compile embedding example. 64 bit is fine.
changed too much to use right now. I need windows h/libs as provided and sample code at the same revision of the api that compiles & runs as expected to continue.
thanks - being clear. almost there :)
going with this instead as apparently the embed API is vendor neutral.
https://github.com/WebAssembly/wasm-c-api/blob/master/example/hello.c
compiles.
link against your lib has following unresolved.
My source file is .cpp. Put an extern "C" around wasm headers.
ahhhh - linked to the dll rather than the static lib, contact :)
don't care. dll will do. so lets see if I can do something. wasm api direct rather than your extensions is better anyhow as want to try various engines in due course & that being the point :)
the unresolved above linking to your static lib, no idea, don't care :) but fyi.
Are you sure that wasmtime supports wasm-c-api? The official C api for wasmtime is at https://github.com/bytecodealliance/wasmtime/blob/master/crates/c-api/include/wasmtime.h
I'm not sure of anything. I hit this code about half an hour ago :)
but it compiles & links, so lets see.
bjorn3 : wasmtime_error_t is used in the wasmtime.h you just referenced (assuming that's trunk) but its not defined in wasmtime-v0.15.0-x86_64-windows-c-api.zip headers, which is why I pivoted to wasm-c-api
wasmtime supports the wasm-c api, not a custom one
wasm_engine_new gets me an instance so I assume its working. have no clue what I'm going yet, but we continue. guessing that sample wants to load a wasm binary that I don't currently have. so need to find that :)
Steve Williams said:
bjorn3 : wasmtime_error_t is used in the wasmtime.h you just referenced (assuming that's trunk) but its not defined in wasmtime-v0.15.0-x86_64-windows-c-api.zip headers, which is why I pivoted to wasm-c-api
It should be defined at https://github.com/bytecodealliance/wasmtime/blob/4d2670afa3d28e17b185b7292ddbfd5e9e4f02ba/crates/c-api/include/wasmtime.h#L15-L20 using a macro
Last updated: Nov 22 2024 at 16:03 UTC