Dashboardclizstd-sys supports wasm32-unknown-unknow…

zstd-sys supports wasm32-unknown-unknown via wasm-shim — C zstd usable in WASM without libc

Category: gotcha
Confidence: 1.00
ID: 019eefda-3a9c-7961-b918-7c05ab8607c3
Project ID: c760f4f9-42b0-4ce0-b36d-6b8c38d770b2
Cross-project: No
Recalled in other projects: 1
Source session: 12na8hXrpthm52Hlq
Created: 2026-06-19 13:10:06
Updated: 2026-06-22 15:01:57

Cross-Project Recalls

ProjectHitsLast recalled
opencode-lore 1 11h ago

Content

Trap: zstd-sys (C zstd) looks incompatible with wasm32-unknown-unknown because it compiles C code and the target has no libc/sysroot. Fix: zstd-sys v2.0.16+ ships wasm-shim/ headers that #define malloc/free/memcpy etc. to rust_zstd_wasm_shim_* Rust functions backed by Rust's allocator. build.rs auto-enables the shim for wasm32-unknown-unknown (controlled by no_wasm_shim feature). Requires clang/lld/llvm installed (sudo apt-get install -y clang lld llvm on Ubuntu). ruzstd was evaluated as pure-Rust alternative but rejected by maintainers (Dav1dde) as significantly slower. CI wasm-build job AND build.yml npm-package job (which runs make npm) BOTH must install clang/lld/llvm before building — npm-package job previously only had binaryen and rustup wasm32-unknown-unknown, causing silent C-zstd compile failures.

Move to: