Replies: 2 comments
|
If the following doesn't help you fix the issue, then please open a repo with a minimal example. [package]
name = "foo"
version = "0.1.0"
edition = "2024"
[dependencies]
libp2p = { version = "0.56.0", features = ["gossipsub"] }
# Native
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
libp2p = { version = "0.56.0", features = ["tokio", "dns", "tcp", "websocket"] }
# WASM (browsers)
[target.'cfg(target_arch = "wasm32")'.dependencies]
libp2p = { version = "0.56.0", features = ["wasm-bindgen", "webrtc-websys"] }
getrandom = { version = "0.3.4", features = ["wasm_js"] }
getrandom_02 = { package = "getrandom", version = "0.2.17", features = ["js"] } |
|
After days again.... of config battle, we finally compiled native and wasm on same crate.. single crate with requirements for native + WASM .cargo/config.toml This simple line compiled native and WASM (with getrandom v0.2.17 and v0.3.4....!!) #.. WASM *after compilation we can clearly see the tree dependency WASM Documentation and guidance needs a serious review, the "wasm_js" and .cargo/config.toml is NOT accurate. But now we got something working. Thanks |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HI
I have opened a Q/A for reference #6244 and still not able to solve the dual compilation and waiting for assistance on this matter.
When will libp2p v0.57 be released?
#6244
“How can we configure a single crate that supports both native (with gossipsub) and WASM (with gossipsub) without getrandom conflicts?”
We maintain a single crate that must support:
Native: TCP/WebSocket + gossipsub
WASM: WebRTC + gossipsub
We’ve solved WASM compilation, but native builds fail due to getrandom v0.3.4 requiring wasm_js feature even on native.
What’s the official recommended way to configure Cargo.toml for dual-target libp2p with gossipsub?
We’re using a local libp2p fork (main branch) and need a stable, maintainable setup.
I appreciate your input
Thanks
All reactions