Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build a wasmtime binary that supports memory64 feature? #7795

Closed
BenSunWhiteBoard opened this issue Jan 19, 2024 · 5 comments
Closed

Comments

@BenSunWhiteBoard
Copy link

Hi, I download the release binary, seems it doesn't enable memory64 by default, my running result:

./wasmtime test.wasm
Error: failed to parse WebAssembly module

Caused by:
        Invalid input WebAssembly code at offset 440: memory64 must be enabled for 64-bit memories

I really appreciate it if someone could help me with how to build a wasmtime that could run memory64 wasm file. And if I enable memory64, can I still run memory32 wasm file?

@BenSunWhiteBoard BenSunWhiteBoard changed the title How to build a wasmtime binary that supports memory64 feature How to build a wasmtime binary that supports memory64 feature? Jan 19, 2024
@bjorn3
Copy link
Contributor

bjorn3 commented Jan 19, 2024

Try wasmtime -W memory64=y test.wasm.

@alexcrichton
Copy link
Member

Yes memory64 support is not a compile-time feature but a runtime feature, so @bjorn3's suggestion should work, but I'll hold off on closing this until @BenSunWhiteBoard you confirm it works for you

@BenSunWhiteBoard
Copy link
Author

Thanks! I tried it with some handwritten wasm samples, and it did work.
One more question though: If wasi-libc support wasm64 after WebAssembly/wasi-libc#444 got merged, there will be new import WASI APIs like fd_close_wasm64. If I understand correctly, it wouldn't be too much work to add a new interface for it from the implementation of fd_close right? I think it's safe to say that at least a large potion of code can be reused. Does wasmtime plan to support those interface in the near future if wasm64 got supported in wasi-libc and wasi-sdk?

@alexcrichton
Copy link
Member

memory64 support for wasm is not specified at this time and it's not clear to me that there's an "obvious" design of how to implement it. That PR is one option but isn't necessarily the only one. In that sense it's hard to say what a memory64 wasi would take effort-wise because to me it's not clear to me what the work will be

@BenSunWhiteBoard
Copy link
Author

Thanks for your kind reply! I have no further questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants