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

[BUG] tinygo not needed #562

Closed
gedw99 opened this issue Jul 17, 2023 · 12 comments
Closed

[BUG] tinygo not needed #562

gedw99 opened this issue Jul 17, 2023 · 12 comments
Assignees
Labels
feat/serverless Feature: Serverless

Comments

@gedw99
Copy link

gedw99 commented Jul 17, 2023

Go now supports wasi compilation.

I have been using gotip also a d it’s been solid so far.

the go team and Wazero Team got it all working.

so the example wasm stuff should offer using go and not tinygo. Or offer both in the docs.

the gotip is also working.

it’s much much faster at compilation then tinygo too.

@gedw99 gedw99 added the bug Something isn't working label Jul 17, 2023
@gedw99
Copy link
Author

gedw99 commented Jul 17, 2023

@fanweixiao
Copy link
Member

Thanks for mention this @gedw99, we will try it!

@gedw99
Copy link
Author

gedw99 commented Jul 17, 2023

some example golang out there is still broken because of this.

"CallImport" has now gone and been replaced with " //go:wasmimport".

Here is an example of failing code for browser WASM. I know it does not really apply to the yomorun use cases but anyway.

you need go1.21rc3 OR gotip...

                                                                   
go version
go version go1.21rc3 darwin/amd64

gogio -x -target js -o explorer.wasm .
go list -f {{.ImportPath}} .
go list -f {{.Dir}} .
go build -ldflags=-X gioui.org/app/internal/log.appID=org.gioui.explorer -tags= -o explorer.wasm/main.wasm .
gogio: go build -ldflags=-X gioui.org/app/internal/log.appID=org.gioui.explorer -tags= -o explorer.wasm/main.wasm . failed: # gioui.org/x/explorer
/Users/apple/go/pkg/mod/gioui.org/[email protected]/explorer/explorer_js.s:6: unrecognized instruction "CallImport"
/Users/apple/go/pkg/mod/gioui.org/[email protected]/explorer/explorer_js.s:10: unrecognized instruction "CallImport"
/Users/apple/go/pkg/mod/gioui.org/[email protected]/explorer/explorer_js.s:14: unrecognized instruction "CallImport"
asm: assembly of /Users/apple/go/pkg/mod/gioui.org/[email protected]/explorer/explorer_js.s failed

And here is tinygo versus go for wasip1, which does relate to Yomorun. Note the GOOS is "wasip1":

Again you need go1.21rc3 OR gotip ...

tinygo build -o main.wasm -target wasm .

GOOS=wasip1 GOARCH=wasm go build -o main.wasm .

@fanweixiao fanweixiao added feat/serverless Feature: Serverless and removed bug Something isn't working labels Jul 18, 2023
@fanweixiao
Copy link
Member

fanweixiao commented Jul 18, 2023

I see, as go1.21 still in RC stage, we will support this after final release.

@gedw99
Copy link
Author

gedw99 commented Aug 31, 2023

It’s out now

@fanweixiao
Copy link
Member

@gedw99 we've just released YoMo v1.5, upgrade to go1.21. wasip1 still in it's very early stage, I think we have wait for couple months before we deps on it.

@gedw99
Copy link
Author

gedw99 commented Sep 7, 2023

Ok cool thanks @fanweixiao

@gedw99 gedw99 closed this as completed Sep 7, 2023
@fanweixiao
Copy link
Member

Ok cool thanks @fanweixiao

Currently, tinygo has its limit for go code, for example, tinygo did not support msgpack, that means the 'yomo build' will fail if the code import msgpack package. If we introduce wasip1 as a 0-experimental level for advanced developers, would be a good idea? Wanna have your advise.

@gedw99
Copy link
Author

gedw99 commented Sep 7, 2023

Well I know me and many others are using golang wasm that is compiled as wasip1. So it works if compile using go or tinygo.

So regarding Message pack I think you should try everything with the go compiler to see if everything works correctly.

I know this is a very flakey answer but i don’t see any other way ..

@fanweixiao
Copy link
Member

The main thing currently lack in go1.21 is go:wasmexport, the proposal is here:

YoMo depends this feature.

@fanweixiao
Copy link
Member

and also mentioned on this hackernews thread: https://news.ycombinator.com/item?id=36387610

Unfortunately exporting functions back to Go seems to be a work in progress, since "//go:wasmexport" directive is not yet implemented. Maybe for 1.22?

@gedw99
Copy link
Author

gedw99 commented Sep 7, 2023

This is complex.

wasip1 is incomplete in terms of the Wasm host runner and the compile exporter. So it’s a multi facetted problem space in the golang world.

https://www.linkedin.com/posts/achille-roussel-b9644b62_go-tinygo-webassembly-activity-7056324342883696640-uEwi

Maybe just stick with go 1.21 but compile wasip1 only using tinygo .
As things improve on go wasip1 then cross test .

wasip2 brings sockets and Wazero , wasi-run and TimeCraft are going to need to allow the host to use sockets to allow guest wasm to talk to the network. Windows support will be shakey. I know TimeCraft are not planning to support it.

So just like linkedIn comments suggest, things are in flux.

nothing either of use can do except mail down what works and watch the space ..,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/serverless Feature: Serverless
Projects
None yet
Development

No branches or pull requests

4 participants