Skip to content

fix(examples): register critical-section impl for canvas_waves wasm build#132

Open
patrick-andrew-anchor wants to merge 1 commit into
junkdog:mainfrom
patrick-andrew-anchor:fix/canvas-waves-critical-section
Open

fix(examples): register critical-section impl for canvas_waves wasm build#132
patrick-andrew-anchor wants to merge 1 commit into
junkdog:mainfrom
patrick-andrew-anchor:fix/canvas-waves-critical-section

Conversation

@patrick-andrew-anchor

Copy link
Copy Markdown

Problem

examples/canvas_waves fails to build for wasm32-unknown-unknown (and thus the GitHub Pages deploy fails at the Build examples step):

rust-lld: error: ...libratatui_core-*.rlib(...): undefined symbol: _critical_section_1_0_acquire
rust-lld: error: ...libratatui_core-*.rlib(...): undefined symbol: _critical_section_1_0_release

The example has no committed lockfile, so a fresh resolve pulls a current ratatui_core (via ratzilla/tachyonfx) that depends on critical-section. On wasm32-unknown-unknown nothing registers a critical-section implementation, so the linker can't resolve the acquire/release symbols.

Fix

Add critical-section with the std feature to canvas_waves, which registers the implementation:

critical-section = { version = "1.1", features = ["std"] }

After this, cargo build --release --target wasm32-unknown-unknown (and trunk build) link cleanly.

Notes

  • This is pre-existing dependency drift, independent of any feature work — reproducible on a fresh checkout + build of main.
  • Single-file change to the example's Cargo.toml; no library code touched.

canvas_waves has no committed lockfile, so a fresh resolve pulls a current
ratatui_core (via ratzilla/tachyonfx) that requires a registered
critical-section implementation. Without one the wasm link fails with
`undefined symbol: _critical_section_1_0_acquire`. Add critical-section with
the std feature to provide it. Pre-existing dependency drift, unrelated to the
ligature feature; kept off the upstream feature branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@orhun orhun left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thx!

would you be possibly interested in fixing this for the other examples too? (if they are a problem there)

@patrick-andrew-anchor

Copy link
Copy Markdown
Author

thx!

would you be possibly interested in fixing this for the other examples too? (if they are a problem there)

I can see if it's an issue, I got CI passing on my fork so 🤷‍♂️

@patrick-andrew-anchor

Copy link
Copy Markdown
Author

Checked the other examples — none need the same treatment, so this stays scoped to canvas_waves:

Example Target Pulls ratatui/tachyonfx/ratzilla?
canvas_waves wasm (trunk) yes → ratatui_corecritical-section
game-console native (glutin + winit) no
terminal-emulator native (glutin + winit + vt100/portable-pty) no
native-terminal native (glutin + winit) no

game-console, terminal-emulator, and native-terminal are native OpenGL apps — they build for the host target, not wasm32-unknown-unknown, and don't depend on ratatui/critical-section. The undefined _critical_section_1_0_acquire symbol only arises on wasm32 (single-threaded, no registered critical-section impl), so native targets are unaffected. canvas_waves is the only Rust example that builds to wasm and pulls ratatui_core (via ratzilla/tachyonfx), so it's the only one that needs the critical-section/std impl.

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.

2 participants