wasmerio / wasmer-c-api

Example of the C API to embed the Wasmer runtime
https://wasmerio.github.io/wasmer/c/runtime-c-api/
80 stars 10 forks source link

WASI Example crashes due to unimplemented ImportObj #16

Open helje5 opened 3 years ago

helje5 commented 3 years ago

When running the WASI example, it just crashes due to the import object not being implemented.

Steps I took:

zMBP20:wasmer-c-api helge$  cc -I$HOME/.wasmer/include -L$HOME/.wasmer/lib wasmer-wasi-c-api-example.c -o test -lwasmer
zMBP20:wasmer-c-api helge$ ./test 
thread '<unnamed>' panicked at 'not yet implemented: wasmer_wasi_generate_import_object: blocked on global store', lib/c-api/src/deprecated/import/wasi.rs:74:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Abort trap: 6

Sure, Rust, I do that for you:

zMBP20:wasmer-c-api helge$ RUST_BACKTRACE=1 ./test 
thread '<unnamed>' panicked at 'not yet implemented: wasmer_wasi_generate_import_object: blocked on global store', lib/c-api/src/deprecated/import/wasi.rs:74:5
stack backtrace:
   0: _rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: _wasmer_wasi_generate_import_object
   3: _main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
Abort trap: 6

zMBP20:wasmer-c-api helge$ RUST_BACKTRACE=full ./test 
thread '<unnamed>' panicked at 'not yet implemented: wasmer_wasi_generate_import_object: blocked on global store', lib/c-api/src/deprecated/import/wasi.rs:74:5
stack backtrace:
   0:        0x10cb70aa4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4b962ed89f71a03
   1:        0x10cbd8910 - core::fmt::write::h94ae1e793baa7a00
   2:        0x10cb6235b - std::io::Write::write_fmt::h5c716758fdc3057f
   3:        0x10cb753c5 - std::panicking::default_hook::{{closure}}::hc6119c7d16548caf
   4:        0x10cb75107 - std::panicking::default_hook::heae8b62897b351dc
   5:        0x10cb75a65 - std::panicking::rust_panic_with_hook::hc36596b4257bea99
   6:        0x10cb755fb - std::panicking::begin_panic_handler::{{closure}}::h49e5ddc3f21ca2fb
   7:        0x10cb70f18 - std::sys_common::backtrace::__rust_end_short_backtrace::h9bd32c9ad3fad18f
   8:        0x10cb755ba - _rust_begin_unwind
   9:        0x10cc3b19b - std::panicking::begin_panic_fmt::hc5bc7b154cdecca6
  10:        0x10c433bb4 - _wasmer_wasi_generate_import_object
  11:        0x10c3eea49 - _main
fatal runtime error: failed to initiate panic, error 5
Abort trap: 6