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

unknown import, Code: 0x62 #9

Open
chris-aeviator opened this issue Jun 1, 2022 · 3 comments
Open

unknown import, Code: 0x62 #9

chris-aeviator opened this issue Jun 1, 2022 · 3 comments

Comments

@chris-aeviator
Copy link

chris-aeviator commented Jun 1, 2022

I'm using the bindgen example to run my rust code. I have followed all steps to setup my environment.

❯ ./bindgen_funcs rust_bindgen_funcs/pkg/rust_bindgen_funcs_lib_bg.wasm
[2022-06-01 18:17:59.023] [error] instantiation failed: unknown import, Code: 0x62
[2022-06-01 18:17:59.023] [error]     When linking module: "env" , function name: "return_error"
[2022-06-01 18:17:59.023] [error]     At AST node: import description
[2022-06-01 18:17:59.023] [error]     At AST node: import section
[2022-06-01 18:17:59.023] [error]     At AST node: module
[2022-06-01 18:17:59.023] [error] execution failed: wrong instance address, Code: 0x80
[2022-06-01 18:17:59.023] [error]     When executing function name: "__wbindgen_malloc"
panic: toWasmEdgeValueSlideBindgen(): malloc failed

goroutine 1 [running]:
github.com/second-state/WasmEdge-go/wasmedge.toWasmEdgeValueSlideBindgen(0x4ae7e6?, 0x4ae7e6?, 0x0, {0xc00005cf40, 0x3, 0x7fc023bc0a68?})
        /home/ME/go/pkg/mod/github.com/second-state/[email protected]/wasmedge/value.go:321 +0xa85
github.com/second-state/WasmEdge-go/wasmedge.(*VM).ExecuteBindgen(0xc00019e060?, {0x4ae7e6, 0xa}, 0xc0000506b0?, {0xc00005cf40, 0x3, 0x3})
        /home/ME/go/pkg/mod/github.com/second-state/[email protected]/wasmedge/vm.go:275 +0xf8
main.main()
        /home/ME/MY-PROJECT/bindgen/bindgen_funcs.go:40 +0x30

unfortunately I cannot make sense on any of those errors.

EDIT:

I now followed the instructions in joey to install everthing and now face

./bindgen_funcs: symbol lookup error: ./bindgen_funcs: undefined symbol: WasmEdge_ModuleInstanceListMemory
@hydai
Copy link
Member

hydai commented Jun 2, 2022

Hi @chris-aeviator
Looks like there are two different errors. However, it could be related to errors.

The first is that the wasm file wants to call an external function env::return_error which is not in the standard, so it failed.
The second is that the given parameters of __wbindgen_malloc is wrong. We will need more information to figure out this. Could you provide the application source code?

And for the edited one, Please make sure the WasmEdge version is the same. We have several breaking changes during 0.8.x, 0.9.x, and 0.10.x. If the version is not matched, then you will receive that some WasmEdge API is not found or not matched.

@chris-aeviator
Copy link
Author

chris-aeviator commented Jun 2, 2022

Could we find another way than sharing the complete code, I'd have to do quite some redacting for that?! I'm doing a bunch of calculations on CSV and JSON data, I tried all combinations of passing it as strings as shown in the example to reading from files, bindgen, and actually it seems not to be related to this actual error, since the error happens before any println output in my code.

The only external crates I'm using are:

  suborbital = "0.13.1"
  csv = "1.1"
  geo = "0.17.1"
  geo-types = "0.7.4"
  serde = { version = "1", features = ["derive"] }
  serde_json = "1"

@hydai
Copy link
Member

hydai commented Jun 2, 2022

Sure thing. We only need the minimum reproducible code snippets.
And I will check if there is any crate that is not compatible with standard wasm/wasi. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants