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

compileopts, targets, main: support Wasmtime v14 #3972

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

ydnar
Copy link
Contributor

@ydnar ydnar commented Oct 22, 2023

This PR adds support for Wasmtime v14 (released 2023-10-20), reenabling support for:

tinygo test -v -target=wasi ./...

  1. Changes --mapdir=GUEST::HOST to --dir=HOST::GUEST
  2. Reorders CLI arguments to wasmtime so Wasmtime arguments are before the .wasm module argument, and arguments to the Go program (e.g. -test.v) are after. The -- argument has no effect.

Note this PR does not attempt to detect the version of Wasmtime being run.

For additional context, see:

Fixes #3970.

@ydnar ydnar changed the base branch from release to dev October 22, 2023 19:06
Copy link

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

lgtm!

@deadprogram
Copy link
Member

The reason the CI tests are failing here, is because the change in this PR is not backward compatible with the old version (v5.0.0) of wasmtime being used for testing. For example, see https://github.com/tinygo-org/tinygo/blob/dev/.github/workflows/linux.yml#L143

So do we want to do one of these?

  • drop support for older wasmtime versions
  • try to detect the wasmtime version
  • add a flag specifying the wamtime version, defaulting to either newest or older
  • switch to wazero
  • something else entirely

Thoughts?

@deadprogram
Copy link
Member

In the meantime, how about #3976 to get our build back to green?

@ydnar
Copy link
Contributor Author

ydnar commented Oct 24, 2023

@deadprogram thsnks! I'll rebase and pin this PR to v14.

Looks like Homebrew just updated to v14 yesterday: https://github.com/Homebrew/homebrew-core/blob/581c110863a917ada65b58cf046d93c2a2f6d105/Formula/w/wasmtime.rb

@ydnar
Copy link
Contributor Author

ydnar commented Oct 24, 2023

@deadprogram rebased, now green.

@ydnar
Copy link
Contributor Author

ydnar commented Oct 26, 2023

It appears that Wasmtime will issue a patch release with backwards compatibility: bytecodealliance/wasmtime#7336 (comment)

Most importantly, work is underway right now to put out a patch release that restores support for the current CLI (while retaining support for the new one as well).

We also agreed on handling the CLI as a stable interface with strong compatibility guarantees, as well as the shape of a process for ensuring that we can keep to these guarantees, as well as how we'll communicate changes to the CLI. We'll publish an RFC detailing this, with ample opportunity to weigh in.

Note that we deem the changes to the new interface foundationally important for these stability guarantees, so the RFC and an accompanying blog post will also include details on how we'll fully transition, and eventually sunset support for the old interface.

ydnar and others added 4 commits November 1, 2023 11:14
Wasmtime v14 (released 2023-10-20) has a breaking change in how CLI arguments are processed.

1. Arguments after the .wasm module to run are passed to the Wasm module. The -- flag has no effect.
2. --mapdir becomes --dir, and the arguments are reversed: --dir=HOST:GUEST
TODO: maybe put Wasmtime version in a variable?
@ydnar
Copy link
Contributor Author

ydnar commented Nov 1, 2023

Wasmtime v14.0.4 should be released this morning, which fixes known outstanding bugs with running tinygo: #3972

This PR adapts the old CLI to the new (v14+) CLI, so could probably be merged anytime before Wasmtime drops backwards compatibility.

@ydnar
Copy link
Contributor Author

ydnar commented Nov 1, 2023

@deadprogram
Copy link
Member

Thanks for helping get this settled @ydnar now going to squash/merge

@deadprogram deadprogram merged commit 174d492 into tinygo-org:dev Nov 2, 2023
15 checks passed
crypto-smoke pushed a commit to meshnet-gophers/tinygo that referenced this pull request Feb 14, 2024
compileopts, targets, main: support Wasmtime v14
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.

wasmtime v14 breaks -target=wasi
3 participants