-
Notifications
You must be signed in to change notification settings - Fork 168
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't run Go template #595
Comments
Downgrading tinygo to 0.25.0 fixed the issue. Adding //go:linkname getCurrentStackPointer tinygo_getCurrentStackPointer
func getCurrentStackPointer() uintptr {
return 0
} to the end of w4/wasm4.go fixed the issue for tinygo 0.26.0 |
Hi, thanks for reporting this! I'm actually not able to repro, but I wonder if something changed with the tinygo's default wasm.json in 0.26, and we need to mirror any changes into the wasm4 project's target.json. Eg: |
BigAngryBob ran into other issues with the tinygo. Tinygo was invoking wasm-opt on its own, but not providing
His versions:
|
I ran into the issue mentioned above (
|
Do you know if it's failing on |
It failed on tinygo. I tried removing the wasm-opt logic from the Makefile and saw the same error. |
As @DenialAdams mentioned, tinygo is internally calling wasm-opt with its own flags. This error happens during the tinygo compilation phase, before the I was able to compile successfully by replacing the template's However, I am now facing the issue: I'm using go tl;dr
|
Replacing all of wasm4/cli/assets/templates/go/target.json Line 21 in aca37f9
Looks like this flag isn't playing nicely with the latest Unfortunately I don't currently know anything about tinygo or wasm to figure out if any of these changes are lining up to produce a correct wasm4 cart. |
I haven't had time to look at this, but more experienced Go developers may have some insight. Ping @peterhellberg @christopher-kleine |
There's a small game I'd like to implement using Go anyway. I'll look into this in the next days, I guess. I'm currently busy with work. |
@christopher-kleine Cool, I have primarily used Zig ⚡ lately for fantasy console related stuff, so have no up to date experience with TinyGo together with WASM-4 |
So far I was able to confirm the problem. I tried the default target.json supplied by WASM4 and also the target.json directly from TinyGo. Both failed. Digging a little, it's stated, that we need the wasm_exec.js from TinyGo instead of the one from Go itself. |
This is still an issue, was trying the same thing and same error on the console. Any leads? |
Sorry, I didn't find anything new. Currently I don't have the time to investigate further, since other things popped up. My best advice so far would be: Either try to downgrade to an earlier version of Tinygo or - if an older version of WASM4 is fine - try the Docker Images. Reminds me: Should I take them down, @aduros ? |
ok so for now here is how to use wasm-4 with go
After all of these, everything should work |
It seems that the problem with the latest versions of Go and TinyGo is still in the incorrect target.json. With these settings, Wasm-4 works for me without errors. In my case, versions Go 1.22.2 and TinyGo 0.31.2 target.json content: |
I can partially confirm this. The "Hello World" example works.
// Edit: I'll try to go through the snake tutorial to figure out where it breaks. |
I got the snake and hello world example to work with the following config: tinygo version 0.33.0 target.json fix{ "ldflags": [ build commandtinygo build -target ./target.json -panic trap -opt=z -scheduler=none -gc=leaking -no-debug -o build/cart.wasm . |
-gc=leaking seems dangerous |
Steps to reproduce:
w4 new foobar --go
make
w4 run build/cart.wasm
Environment:
The text was updated successfully, but these errors were encountered: