-
Notifications
You must be signed in to change notification settings - Fork 31
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
Can I use go1.21 to compile plugins? #58
Comments
@knqyf263 do you see any chance to support cross compiling without tinygo? |
I remember Go's wasip1 was complicated and difficult to run as Wasm, but it has been over a year since I tried it before, so we may try again. Contributions are welcome. |
The issue seems to be that we exclude this file because CGO is disabled for https://github.com/knqyf263/go-plugin/blob/main/wasm/plugin.go If we enable CGO
|
We need to figure out how to do the same thing with Go wasip1. |
I was playing around with the code a bit. Right now don't see any way to get the memory from a malloc without cgo. It also looks like that there will be no cgo support soon for the native golang wasm compiler: golang/go#40543 |
Big Go's wasip1 target still doesn't support exporting functions from Wasm module. See golang/go#65199 So this means. until it's done it won't be feasible. |
Most likely it does. However there is another issue that needs to be considered. TinyGo does not actually stop the module when // main is required for TinyGo to compile to Wasm.
func main() {
greeting.RegisterGreeter(GoodEvening{})
} Exiting
As far as I'm aware TinyGo merged "Reactor" support into Also, I'm not sure whether "Reactor" mode is 100% suitable for In order to make it consistent with big Go's planned implementation I see following options:
|
Thanks for the details. Sounds like we need some hacks for Go. |
I recently implemented support for big Go for proxy-wasm as a wasi reactor in proxy-wasm/proxy-wasm-go-sdk#1. The required work included:
It was blocked on the wasmexport proposal and WASI reactor support, which was implemented recently by the go core team.
I haven't looked deeply into The host is able to access the wasm module's linear memory, and pointers inside the linear memory can be alloc'd and passed by either side of the wasm module boundary. I'd be happy to take a look or answer some questions if you have more questions about our approach! |
@leonm1 Thanks for the detailed explanation. According to your work, adding big Go support doesn't sound so challenging. It would be great if someone could work on that. |
I just have tried to compile with go tool, since support for
wasip1
added ingo1.21
, and got this error:Note that I'm passing
-tags=tinygo.wasm
, because my plugin code is also protected with this build constraint. However, error message sounds like ifgo-plugin
is not intended for use with official go compiler at all?The text was updated successfully, but these errors were encountered: