You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
cd lucet/docs/lucet-runtime-example
cp hello.so into docs/lucet-runtime-example/
src/main.rs content:
use lucet_runtime::{DlModule, Limits, MmapRegion, Region};
use lucet_wasi::WasiCtxBuilder;
fn main() {
// ensure the WASI symbols are exported from the final executable
lucet_wasi::export_wasi_funcs();
// load the compiled Lucet module
let dl_module = DlModule::load("hello.so").unwrap();
// create a new memory region with default limits on heap and stack size
let region = MmapRegion::create(1, &Limits::default().with_heap_memory_size(100 * 16 * 64 * 1024)).unwrap();
// instantiate the module in the memory region
let mut instance = region.new_instance(dl_module).unwrap();
// prepare the WASI context, inheriting stdio handles from the host executable
let wasi_ctx = WasiCtxBuilder::new().inherit_stdio().build();
instance.insert_embed_ctx(wasi_ctx);
// run the WASI main function
instance.run("_start", &[]).unwrap();
}
Thanks for this report. lucet-runtime-example is incorrect here, and this never got caught because it is not tested in CI. Since #655, any use of lucet-wasi requires instances be run as async inside the tokio runtime.
We realize this restriction is pretty heavy, but lucet is approaching its EOL and lucet isn't structured to make supporting both sync and async versions of wasi easy. We recommend users transition to our sister project, wasmtime, which at this point supports everything lucet does, as well as many new wasm features which lucet does not. Wasmtime supports wasi both on sync rust and on top of tokio.
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: RuntimeTerminated(TerminationDetails::BlockOnNeedsAsync)'lucet version is latest master branch
git clone https://github.com/bytecodealliance/lucet.git
Follow is my steps:
cd ~/workplace
mkdir hello
cd hello
vim hello.c
wasm32-wasi-clang -Ofast -o hello.wasm hello.c
lucetc-wasi -o hello.so hello.wasm
lucet-wasi hello.so
output:
Hello world
cd lucet/docs/lucet-runtime-example
cp hello.so into docs/lucet-runtime-example/
src/main.rs content:
project files:
cargo run
Result:
Compiling lucet-runtime-example v0.1.0 (/home/ubuntu/workplace/lucet/docs/lucet-runtime-example)
Finished dev [unoptimized + debuginfo] target(s) in 10.30s
Running
/home/ubuntu/workplace/lucet/target/debug/lucet-runtime-example
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: RuntimeTerminated(TerminationDetails::BlockOnNeedsAsync)', docs/lucet-runtime-example/src/main.rs:17:33Who can tell me why? thanks a lot
The text was updated successfully, but these errors were encountered: