Skip to content

go/wasm: Update to Tinygo 0.35.0 #4002

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

Merged
merged 1 commit into from
Feb 12, 2025
Merged

go/wasm: Update to Tinygo 0.35.0 #4002

merged 1 commit into from
Feb 12, 2025

Conversation

burak-ok
Copy link
Member

@burak-ok burak-ok commented Feb 7, 2025

go/wasm: Update to Tinygo 0.35.0

This uses the newest info from tetratelabs/wazero#2368

@burak-ok burak-ok force-pushed the burak/wasm/tinygo.0.35.0 branch 3 times, most recently from 213a33d to 1d993ac Compare February 7, 2025 14:45
@alban
Copy link
Member

alban commented Feb 10, 2025

I am wondering about the UX: does it give a specific error message if trying to run an old version of a gadget with this new version of ig?

@burak-ok
Copy link
Member Author

  1. The go:wasmexport there should be no problem. This is just the new directive to export the function.
  2. The .WithStartFunctions("_initialize") shouldn't also be a problem AFAIK. I don't know how it behaved in the previous versions of tinygo but this just annotates that the start function of the module is _initialize instead of _start (This is the requirement of the reactor concept)
$ burak/wasm/tinygo.0.35.0 ✓ ➭ go run --exec "sudo -E" ./cmd/ig run trace_exec:v0.37.0
RUNTIME.CONTAINERNAME                 COMM                    PID        TID ARGS                   ERROR
reverent_elbakyan                     sh                    13932      13932 /bin/sh                  
reverent_elbakyan                     date                  13956      13956 /bin/date foo bar             

@eiffel-fl
Copy link
Member

eiffel-fl commented Feb 11, 2025

  1. The go:wasmexport there should be no problem. This is just the new directive to export the function.

    1. The .WithStartFunctions("_initialize") shouldn't also be a problem AFAIK. I don't know how it behaved in the previous versions of tinygo but this just annotates that the start function of the module is _initialize instead of _start (This is the requirement of the reactor concept)
$ burak/wasm/tinygo.0.35.0 ✓ ➭ go run --exec "sudo -E" ./cmd/ig run trace_exec:v0.37.0
RUNTIME.CONTAINERNAME                 COMM                    PID        TID ARGS                   ERROR
reverent_elbakyan                     sh                    13932      13932 /bin/sh                  
reverent_elbakyan                     date                  13956      13956 /bin/date foo bar             

So, for now, tinygo gives us compatibility with both the old and new way of exporting function.
Do they state until when they will keep this?

@burak-ok
Copy link
Member Author

So, for now, tinygo gives us compatibility with both the old and new way of exporting function.
Do they state until when they will keep this?

There is no compatibility AFAIK. If you try to compile old gadgets with 1.25 it will fail (I think at least). The simple test output I showed was running a compiled 1.24 WASM layer with the modifications in our wazero host settings.

So the compiliation might fail or not work. But already compiled gadgets with tinygo 1.24 should still work

@eiffel-fl
Copy link
Member

So, for now, tinygo gives us compatibility with both the old and new way of exporting function.
Do they state until when they will keep this?

There is no compatibility AFAIK. If you try to compile old gadgets with 1.25 it will fail (I think at least). The simple test output I showed was running a compiled 1.24 WASM layer with the modifications in our wazero host settings.

What do you mean by 1.24 and 1.25?
So, if an user has an old gadget still using the old syntax, they would be able to run it with a newer ig (using tinygo 0.35), but if they try to compile it again they would get an error message?

So the compiliation might fail or not work. But already compiled gadgets with tinygo 1.24 should still work

@burak-ok
Copy link
Member Author

So, for now, tinygo gives us compatibility with both the old and new way of exporting function.
Do they state until when they will keep this?

There is no compatibility AFAIK. If you try to compile old gadgets with 1.25 it will fail (I think at least). The simple test output I showed was running a compiled 1.24 WASM layer with the modifications in our wazero host settings.

What do you mean by 1.24 and 1.25?

Sorry, my brain was at Go 1.24 :/
I meant tinygo 0.34 and 0.35

So, if an user has an old gadget still using the old syntax, they would be able to run it with a newer ig (using tinygo 0.35), but if they try to compile it again they would get an error message?

I think no compilation error, there might be an error when the gadget runs, that it can't find the exported functions that it expects

@eiffel-fl
Copy link
Member

So, for now, tinygo gives us compatibility with both the old and new way of exporting function.
Do they state until when they will keep this?

There is no compatibility AFAIK. If you try to compile old gadgets with 1.25 it will fail (I think at least). The simple test output I showed was running a compiled 1.24 WASM layer with the modifications in our wazero host settings.

What do you mean by 1.24 and 1.25?

Sorry, my brain was at Go 1.24 :/ I meant tinygo 0.34 and 0.35

So, if an user has an old gadget still using the old syntax, they would be able to run it with a newer ig (using tinygo 0.35), but if they try to compile it again they would get an error message?

I think no compilation error, there might be an error when the gadget runs, that it can't find the exported functions that it expects

So, an old gadget could not be used with a newer version of ig using a newer version of tinygo?
If I remember correctly, we wanted to ensure it was possible for an old gadget to be used with a newer version of ig.

@burak-ok
Copy link
Member Author

If I remember correctly, we wanted to ensure it was possible for an old gadget to be used with a newer version of ig.

That would be nice - But we aren't guaranteeing it today even in other PRs. They break left and right

So, an old gadget could not be used with a newer version of ig using a newer version of tinygo?

Every gadget this is already compiled will work. If you try to compile a gadget that didn't receive the changes in this PR, now with the tinygo update from this PR you get the issues. Maybe the following table helps to paint a better picture.

IG Version Gadget source code prior to this PR Gadget source code after this PR Gadget compiled prior to this PR Gadget compiled after this PR
IG prior this PR Build no problem - Runs without problem Build no problem - Doesn't run Runs without problem Runs without problem
IG after this PR Build no problem - Doesn't run Build no problem - Runs without problem Runs without problem Runs without problem

Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'm aware of the IG vs gadget compatibility issues, I'll create an issue soon to go deeper on that, but it doesn't block this issue. Thanks Burak for handling this!

@burak-ok burak-ok force-pushed the burak/wasm/tinygo.0.35.0 branch from 1d993ac to 48bb1fe Compare February 12, 2025 08:58
Signed-off-by: Burak Ok <burakok@microsoft.com>
@burak-ok burak-ok force-pushed the burak/wasm/tinygo.0.35.0 branch from 48bb1fe to 5d8e56e Compare February 12, 2025 09:40
@burak-ok burak-ok merged commit 3feb726 into main Feb 12, 2025
77 checks passed
@burak-ok burak-ok deleted the burak/wasm/tinygo.0.35.0 branch February 12, 2025 11:06
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

Successfully merging this pull request may close these issues.

4 participants