Repository navigation
fix: restore the wasm build on the current toolchain - #20
Merged
Merged
Conversation
Rust 1.82 stopped implicitly turning undefined symbols into `env` imports on wasm32-unknown-unknown, so linking the wasm crate started failing with `undefined symbol: tx / rx / keydown / elapsed_us` once the toolchain pin moved off 1.80. Name the import module explicitly on the extern block. Rebuild `out.wasm` so the playground picks this up along with the DIV, x0 and 8250 divisor latch fixes, and build both wasm targets in CI so this cannot break silently again. `wasm32-wasi` no longer exists either, so the WASI instructions move to `wasm32-wasip1`. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cargo build -p wasm --target wasm32-unknown-unknownfails to link:Rust 1.82 stopped implicitly resolving undefined symbols in an
extern "C"block to imports from theenvmodule onwasm32-unknown-unknown. The build worked whilerust-toolchainpinned 1.80.0 and broke as soon as the pin moved to 1.96.1 in #18, but nothing noticed because CI only builds the host target andwasm/out.wasmis a prebuilt artifact committed to the repo.Changes
wasm/src/lib.rswith#[link(wasm_import_module = "env")]. This matches whatworker.jssupplies and what thewasm-opt --pass-arg=asyncify-imports@env.keydownstep in the README already assumes.wasm/out.wasm. The deployed playground was still running a binary from before fix: make vi (and other full-screen apps) usable, plus assorted CPU/bus correctness fixes #18, so it did not have theDIV,x0, out-of-range access or 8250 divisor latch fixes. The rebuilt module also drops from 5.1 MB to 3.5 MB.wasm32-wasiwas removed from the toolchain, so the WASI instructions in the README now usewasm32-wasip1.Testing
cargo build -p wasm --release --target wasm32-unknown-unknownandcargo build -p wasi --release --target wasm32-wasip1both succeed on 1.96.1.wasm/directory locally, booted Linux in the browser, logged in and openedvi /etc/passwd. The full-screen UI draws correctly.mand`characters that the currently deployed build prints around theprintk: console [ttyS0] enabledlines are gone, which confirms the divisor latch fix is now in the playground binary.Made with Cursor