fix: resolve wasm build failure by updating burn deps and removing getrandom workaround#144
Merged
antimora merged 4 commits intotracel-ai:mainfrom Feb 11, 2026
Merged
Conversation
7 tasks
There was a problem hiding this comment.
Pull request overview
Fixes the wasm32-unknown-unknown build failure for the image-classification-web example caused by getrandom 0.3 requiring an explicit wasm backend configuration, by removing the local workaround/dependency and updating Burn/CubeCL-related deps so getrandom is no longer pulled in the problematic way.
Changes:
- Removed the
--cfg getrandom_backend="wasm_js"workaround from the web build script. - Removed the
getrandomdependency and theburn-store/stdfeature override from the wasm example. - Updated Burn git dependencies (and
Cargo.lock) to incorporate the rand/rand_core upgrade chain needed for the broader fix.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| examples/image-classification-web/build-for-web.sh | Drops the getrandom_backend RUSTFLAGS workaround for wasm builds. |
| examples/image-classification-web/Cargo.toml | Removes direct getrandom usage and avoids enabling burn-store’s std feature in the wasm example. |
| Cargo.toml | Updates workspace Burn git dependencies to a revision containing the rand upgrade (currently via a fork). |
| Cargo.lock | Locks updated dependency graph reflecting Burn/CubeCL/CubeK updates and rand/getrandom reshaping. |
d6c8ec5 to
c3430a0
Compare
Remove the getrandom wasm_js dep and burn-store/std feature. These are no longer needed after upstream fixes in cubecl (tracel-ai/cubecl#1184) and cubek (tracel-ai/cubek#86) that stop unconditional std feature propagation. Fixes tracel-ai#135
Point burn deps at antimora/burn@6d0c9bd which includes the rand 0.9 to 0.10 upgrade. This resolves the getrandom 0.3 issue on wasm32-unknown-unknown since the upstream cubecl/cubek fixes now properly propagate through burn. Also removes the --cfg getrandom_backend="wasm_js" workaround from build-for-web.sh since it is no longer needed.
Update burn dependency from fork to tracel-ai/burn merged commit (PR #4500) which includes the rand 0.10 upgrade. Also remove unused serde_json and js-sys dependencies from image-classification-web.
9059c7d to
8a7a9cb
Compare
Collaborator
Author
|
@laggui , thank you for assistance with this matter! |
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.
Summary
Fixes #135 - wasm build of
image-classification-webfails becausegetrandomrequires explicit backend configuration onwasm32-unknown-unknown.Root cause
The
getrandomcrate was being pulled into the wasm build through a chain of unconditionalstdfeature propagation:burn-wgpu->cubecl/std->cubek/std->cubecl/std(circular) ->getrandom/std. Onwasm32-unknown-unknown,getrandomrequires either thewasm_jsorwasm_wasifeature to be explicitly enabled.Fix (3 repos)
stdfeature propagationcubecl/stdgetrandomdependency andburn-store/stdfeature from wasm example--cfg getrandom_backend="wasm_js"workaround frombuild-for-web.shserde_jsonandjs-sysdependencies from wasm exampleChanges
examples/image-classification-web/Cargo.toml- removedgetrandomdep,burn-store/stdfeature, unusedserde_jsonandjs-sysexamples/image-classification-web/build-for-web.sh- removed--cfg getrandom_backend="wasm_js"from RUSTFLAGSCargo.toml- updated burn git rev to tracel-ai/burn merged commit (PR #4500)Cargo.lock- updatedTest plan
cargo test -p onnx-ir -p burn-onnx -p onnx-testsall passwasm-pack buildsucceeds for SIMD variant (wasm32-unknown-unknown)wasm-pack buildsucceeds for non-SIMD variant (wasm32-unknown-unknown)build-for-web.shscript passes--cfg getrandom_backendworkaround neededTested locally: