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 use the staticlib engine in Rust #2827

Closed
recmo opened this issue Mar 24, 2022 · 3 comments
Closed

How to use the staticlib engine in Rust #2827

recmo opened this issue Mar 24, 2022 · 3 comments
Assignees
Labels
priority-medium Medium priority issue ❓ question I've a question! 🏚 stale Inactive issues or PR
Milestone

Comments

@recmo
Copy link

recmo commented Mar 24, 2022

Summary

I have a Rust library that calls a wasm library. Currently I include_bytes! the wasm bytecode. It is going to run on mobile devices, so reducing resources is important. I would like to statically compile and link the bytecode.

Additional details

I tried

const WASM_STATICLIB: &[u8] = include_bytes!("wasm_staticlib.o");
let store = Store::new(&Staticlib::headless().engine());
let module = unsafe { Module::deserialize(&store, WASM_STATICLIB).unwrap() };

but this panics with

wasm should be valid: CorruptedBinary("misaligned metadata")

This happens no matter if the .o file is created using Module::serialize or the wasmer CLI:

wasmer compile path/to/wasm/file.wasm --llvm --staticlib -o my_wasm.o --header my_wasm.h
@recmo recmo added the ❓ question I've a question! label Mar 24, 2022
@heyjdp
Copy link

heyjdp commented Apr 27, 2022

Thanks for the ticket. We have a Wasmer engine refactor planned, and we will incorporate this request into Wasmer 3.x

@heyjdp heyjdp added this to the v3.x milestone Apr 27, 2022
@heyjdp heyjdp added the priority-medium Medium priority issue label Apr 27, 2022
@stale
Copy link

stale bot commented Apr 28, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale Inactive issues or PR label Apr 28, 2023
@ptitSeb
Copy link
Contributor

ptitSeb commented Apr 28, 2023

This ticket seems outdated now. I close it. Feel free to re-open it if the issue is still present on curretn wasmer version.

@ptitSeb ptitSeb closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-medium Medium priority issue ❓ question I've a question! 🏚 stale Inactive issues or PR
Projects
None yet
Development

No branches or pull requests

4 participants