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

Go: TinyGo 0.3.3 wasp2 compiler target does not work with wit-bindgen-go v0.30.0 #1038

Open
siris opened this issue Aug 23, 2024 · 2 comments

Comments

@siris
Copy link

siris commented Aug 23, 2024

TinyGo 0.3.3 was released on August 20, 2024 and adds support for WASI preview 2 compilations via its new wasip2 compiler target.

I am currently using wit-bindgen to run Go Wasm compiled by TinyGo to the wasi target to then run on-top of Wasmtime. Everything works fine with the latest wit-bindgen-cli crate v0.30.0 and the wasi TinyGo target. But when testing the new wasip2 from TinyGo 0.3.3 using this command:

tinygo build -target wasip2 -no-debug -opt s -o helloworld.wasm helloworld.go

This is the compilation error I am seeing:

# github.com/REDACTED/go-REDACTED
../../../../go/pkg/mod/github.com/!REDACTED/[email protected]/REDACTED.go:4:13: note: in file included from REDACTED.go!cgo.c:2:
../../../../go/pkg/mod/github.com/!REDACTED/[email protected]/REDACTED.go:5:13: fatal: 'stdlib.h' file not found
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:12:11: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:13:3: error: unknown type name 'size_t'
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:13:10: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:19:14: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:20:3: error: unknown type name 'size_t'
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:20:10: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:24:21: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:25:21: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:29:38: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:30:3: error: unknown type name 'size_t'
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:30:10: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:34:8: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:35:30: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:39:39: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:40:35: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:41:28: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:57:34: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:58:31: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:59:35: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:60:28: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:82:8: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:84:48: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:85:45: expected a bitfield
../../../../go/pkg/mod/github.com/!REDACTED/REDACTED.h:86:5: expected a bitfield

Does something need to be changed in wit-bindgen to support the new TinyGo wasip2 target?

@Mossaka
Copy link
Member

Mossaka commented Aug 24, 2024

Thanks for raising this issue. Have you checked out this repo, https://github.com/ydnar/wasm-tools-go by @ydnar? It implements the wit bindings in pure Go instead of CGo and we are transitioning to replace wit-bindgen-go in this repo with it.

@ydnar
Copy link

ydnar commented Nov 6, 2024

wit-bindgen-go has moved! https://github.com/bytecodealliance/go-modules

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

3 participants