Stream: cargo-component

Topic: python - imported resources not yet supported


view this post on Zulip link-verses (Sep 08 2024 at 00:57):

For my wasm component generated with cargo component build, I get this error when trying to run python -m wasmtime.bindgen test_component.wasm --out-dir ./to generate Python bindings. What could be wrong?

thread '<unnamed>' panicked at src/bindgen.rs:2912:29:
not implemented: imported resources not yet supported
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/bindgen/__main__.py", line 40, in <module>
    main()
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/bindgen/__main__.py", line 30, in main
    files = generate(name, contents)
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/bindgen/__init__.py", line 151, in generate
    result = root.generate(store, name, component)
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/bindgen/generated/__init__.py", line 301, in generate
    ret = self.lift_callee0(caller, ptr, len0, ptr1, len2)
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/_func.py", line 93, in __call__
    with enter_wasm(store) as trap:
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/Users/link/.pyenv/versions/3.10.14/lib/python3.10/site-packages/wasmtime/_func.py", line 265, in enter_wasm
    raise trap_obj
wasmtime._trap.Trap: error while executing at wasm backtrace:
    0: 0x22002d - bindgen.wasm!__rust_start_panic
    1: 0x21fec7 - bindgen.wasm!rust_panic
    2: 0x21fc7d - bindgen.wasm!std::panicking::rust_panic_with_hook::h8bb4f94cf9e68e20
    3: 0x21f0d6 - bindgen.wasm!std::panicking::begin_panic_handler::{{closure}}::h2c354a3372fcca00
    4: 0x21f006 - bindgen.wasm!std::sys_common::backtrace::__rust_end_short_backtrace::hf791a0fba63af5e9
    5: 0x21f815 - bindgen.wasm!rust_begin_unwind
    6: 0x22d087 - bindgen.wasm!core::panicking::panic_fmt::haadcabb094f4c85b
    7: 0x17351 - bindgen.wasm!<bindgen::bindgen::FunctionBindgen as wit_bindgen_core::abi::Bindgen>::emit::h635a20f3d6400f8e
    8: 0x29d9d - bindgen.wasm!wit_bindgen_core::abi::Generator<B>::emit::h848ae597d3316472
    9: 0x2ae1f - bindgen.wasm!wit_bindgen_core::abi::Generator<B>::lift::h81beb8073ceff217
   10: 0x3129b - bindgen.wasm!wit_bindgen_core::abi::call::hb3befabe2422e81c
   11: 0xd9bc - bindgen.wasm!bindgen::bindgen::Instantiator::bindgen::hb3f0b54582245b85
   12: 0xb80d - bindgen.wasm!bindgen::bindgen::WasmtimePy::instantiate::h273134b8fef86c5a
   13: 0x670f - bindgen.wasm!bindgen::bindgen::WasmtimePy::generate::h769c77b772b97fad
   14: 0x36cc2 - bindgen.wasm!<bindgen::bindings::PythonBindings as bindgen::bindings::Guest>::generate::hf29e157707bcbd77
   15: 0x36e75 - bindgen.wasm!generate

Caused by:
    wasm trap: wasm `unreachable` instruction executed

Last updated: Nov 25 2024 at 19:03 UTC