-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Description
Hi, I'm encountering an issue where defining __getrandom_v03_custom as per the documentation (https://docs.rs/getrandom/0.3.2/getrandom/#opt-in-backends) does not prevent wasm-bindgen from being imported when targeting wasm32-unknown-unknown for deployment on the Internet Computer (IC). Despite disabling default features and enabling the custom backend via --cfg getrandom_backend="custom", the resulting WASM file still contains __wbindgen_describe imports, causing deployment failures on IC.
Expected Behavior
According to the documentation, defining __getrandom_v03_custom and enabling the custom backend should override the default wasm_js backend, avoiding the dependency on wasm-bindgen and its associated imports (e.g., __wbindgen_describe).
Actual Behavior
Even with the custom function defined and the configuration applied, wasm-bindgen is still linked into the final WASM binary, as verified by wasm-objdump -x. This leads to deployment errors on the Internet Computer, which does not support wasm-bindgen imports.
According to my query, the dependency chain is: burn -> rand -> getrandom
[package]
name = "burn_price_backend"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
candid = "0.10"
ic-cdk = "0.16"
ic-cdk-macros = "0.13"
bincode = "1.3.3"
burn = { git = "https://github.com/burn-rs/burn", default-features = false, features = ["std", "ndarray", "autodiff"] }
serde = { version = "1.0", features = ["derive"] }
getrandom = { version = "0.3.2", default-features = false }
.cargo/config.toml
[build]
rustflags = ["--cfg", "getrandom_backend=\"custom\""]
target = "wasm32-unknown-unknown"
This is my code repository:
https://github.com/e274426380/burn_price