-
SummaryTrying to use wasmer to work with a wasm object compiled from Go. When using wasmer, to create the instance, it throws an error. This wasm object works for js web assembly. This is the error thrown: RuntimeError: Error while importing "go"."debug": unknown import. Expected Function(FunctionType { params: [I32], results: [] })` Not sure of what the issue may be, so don't where to look in order to debug the issue. Any info you may have would be greatly appreciated. Thanks much! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Your module try to use go debug function and it's not part of the wasi standard. Did you target WASM32-WASI or something else? What command line did you used? something like |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the quick response. This is the the full shell script:
|
Beta Was this translation helpful? Give feedback.
-
You are building with You can build with Go for WASM, but then you will need to provide all the required interaction with the Wasm code yourself (via function exports and imports). You can also use You need to pick between one of those options, but building for JS will not work. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the details, much appreciated. :) I'm new to web assembly stuff.
In all honesty, not sure how to do that. Could you point me to a good example so I can wrap my head around how it works? Again much appreciated. |
Beta Was this translation helpful? Give feedback.
-
Hey @inviti8, I haven't used |
Beta Was this translation helpful? Give feedback.
You are building with
GOOS=js
, which builds for the browser and requires a Javascript helper that provides thego.debug
import.You can build with Go for WASM, but then you will need to provide all the required interaction with the Wasm code yourself (via function exports and imports).
You can also use
tinygo
, which has WASI support. WASI allows you to use basic things like standard IO (stdin,out,err), file system access, etc.You need to pick between one of those options, but building for JS will not work.