Stream: wasmtime

Topic: cannot instance tree-sitter wasm


view this post on Zulip csmoe (Jul 05 2022 at 10:13):

I tried to read a tree-sitter wasm file but wasmtime failed with Error: expected 4 imports, found 0

        let wasm_path = format!(
            "tree-sitter-swift.wasm" );
        let mut store = Store::<()>::default();
        let module = Module::from_file(store.engine(), &wasm_path)?;
        let instance = Instance::new(&mut store, &module, &[])?; // error

tree-sitter-swift.wasm
how can I debug it? the wasm is compiled by emcc

An incremental parsing system for programming tools - tree-sitter/build-wasm at 01df16ca9faa1635909ebea242deac200624d9ee · tree-sitter/tree-sitter

view this post on Zulip bjorn3 (Jul 05 2022 at 11:00):

Emscripten compiled wasm modules can only be loaded by the emscripten generated javascript shim.

view this post on Zulip bjorn3 (Jul 05 2022 at 11:01):

You should probably compile for wasi instead.

view this post on Zulip csmoe (Jul 05 2022 at 11:09):

thanks :heart:


Last updated: Dec 23 2024 at 13:07 UTC