2
3
Fork
You've already forked databook
1

[WIP] Upgrading the bindgen for host and guest (WASM) #26

Draft
era wants to merge 10 commits from era/upgradewit into main
pull from: era/upgradewit
merge into: era:main
era:main
era:feature/front-back-communication
era:feature/initial-layout-structure-web
era:elias/wit_bindgen3
era:feature/adding-sveltekit-web
Owner
Copy link

It's been a while since this project was sync'ed with wit-bindgen project. There was a couple of changes, but the most important are:

  1. wit-bindgen-host-wasmtime-rust was moved to wasmtime
  2. We have a new syntax for wit files

This lead to some problems:

  1. When starting the server, the compiled wasm example plugin does not work error: failed to parse WebAssembly module caused by: attempted to parse a wasm module with a component parser

Solution:

cargo build --target wasm32-wasi
wasm-tools component new ./target/wasm32-wasi/debug/my-project.wasm \
 -o my-component.wasm --adapt ./wasi_snapshot_preview1.wasm
  1. Wasi context

The linker changed to use wasmtime::component::Linker which is not compatible with wasmtime::Linker needed to link the default WasiCtx. Currently there is some work to handle this in a preview repo from Wasmtime, but that repo is very much unstable: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/WasiCtx.20and.20component.3A.3ALinker

It's been a while since this project was sync'ed with wit-bindgen project. There was a couple of changes, but the most important are: 1. wit-bindgen-host-wasmtime-rust was moved to wasmtime 2. We have a new syntax for wit files This lead to some problems: 1. When starting the server, the compiled wasm example plugin does not work error: `failed to parse WebAssembly module caused by: attempted to parse a wasm module with a component parser` Solution: ``` cargo build --target wasm32-wasi wasm-tools component new ./target/wasm32-wasi/debug/my-project.wasm \ -o my-component.wasm --adapt ./wasi_snapshot_preview1.wasm ``` 2. Wasi context The linker changed to use `wasmtime::component::Linker` which is not compatible with `wasmtime::Linker` needed to link the default WasiCtx. Currently there is some work to handle this in a preview repo from Wasmtime, but that repo is very much unstable: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/WasiCtx.20and.20component.3A.3ALinker
Author
Owner
Copy link
we also need the preview1 file from: https://github.com/bytecodealliance/preview2-prototyping/releases/tag/latest
Author
Owner
Copy link

New issue and blocking issue:

error while instantiating plugin import `wasi-stderr` not defined

The issue is that the wasmtime generated add_to_linker takes a Component::Linker and not a normal Linker.

related issue: https://github.com/bytecodealliance/wasmtime/issues/4303

While this is not formalized better, there is no point in keep trying to update it.

Relevant: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/WasiCtx.20and.20component.3A.3ALinker

New issue and blocking issue: ``` error while instantiating plugin import `wasi-stderr` not defined ``` The issue is that the wasmtime generated `add_to_linker` takes a Component::Linker and not a normal Linker. related issue: https://github.com/bytecodealliance/wasmtime/issues/4303 While this is not formalized better, there is no point in keep trying to update it. Relevant: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/WasiCtx.20and.20component.3A.3ALinker
era force-pushed era/upgradewit from a6d88e12db to 51159d9d02 2023年02月16日 21:45:05 +01:00 Compare
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin era/upgradewit:era/upgradewit
git switch era/upgradewit

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff era/upgradewit
git switch era/upgradewit
git rebase main
git switch main
git merge --ff-only era/upgradewit
git switch era/upgradewit
git rebase main
git switch main
git merge --no-ff era/upgradewit
git switch main
git merge --squash era/upgradewit
git switch main
git merge --ff-only era/upgradewit
git switch main
git merge era/upgradewit
git push origin main
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
era/databook!26
Reference in a new issue
era/databook
No description provided.
Delete branch "era/upgradewit"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?