backtrace-rs icon indicating copy to clipboard operation
backtrace-rs copied to clipboard

duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `panic_impl`.

Open tauruswei opened this issue 2 years ago • 3 comments

First, i install backtrace in polkadot, then i compile polkadot, but get an error: error: duplicate lang item in crate sp_io(whichsp_application_cryptodepends on):panic_impl`.

= note: the lang item is first defined in crate std (which backtrace depends on)

= note: first definition in `std` loaded from /Users/fengxiaoxiao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libstd-a237209e92b55a70.rlib

= note: second definition in `sp_io` loaded from /Users/fengxiaoxiao/work/rust/polkadot/target/release/wbuild/westend-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-3f9db0758c2475a6.rmeta

error: duplicate lang item in crate sp_io(whichsp_application_cryptodepends on):oom`.

= note: the lang item is first defined in crate `std` (which `backtrace` depends on)

= note: first definition in `std` loaded from /Users/fengxiaoxiao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libstd-a237209e92b55a70.rlib

= note: second definition in `sp_io` loaded from /Users/fengxiaoxiao/work/rust/polkadot/target/release/wbuild/westend-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-3f9db0758c2475a6.rmeta`

The cargo.toml is : `[package] authors = ["Parity Technologies [email protected]"] edition = "2021" name = "xcm-executor" description = "An abstract and configurable XCM message executor." version = "0.9.28"

[dependencies] impl-trait-for-tuples = "0.2.2" parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive"] } xcm = { path = "..", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" } log = { version = "0.4.17", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.28" } backtrace = "0.3"

[features] default = ["std"] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", ] std = [ "parity-scale-codec/std", "xcm/std", "sp-std/std", "sp-io/std", "sp-arithmetic/std", "sp-core/std", "sp-runtime/std", "frame-support/std", "log/std", ]` can anyone help me??

tauruswei avatar Sep 02 '22 10:09 tauruswei

You can't use libstd with substrate programs if you don't enable the std feature of the substrate crates because of https://github.com/paritytech/substrate/blob/e986f05062a5c7a8608967febcd5c1d2bb02eb40/primitives/io/src/lib.rs#L1716-L1746. Backtrace-rs needs libstd. In addition wasm (which substrate compiles your program to) doesn't allow you to get backtraces anyway. In any case this is not a problem with backtrace-rs. Any crate using libstd would give the same issue.

bjorn3 avatar Sep 02 '22 11:09 bjorn3

You can't use libstd with substrate programs if you don't enable the std feature of the substrate crates because of https://github.com/paritytech/substrate/blob/e986f05062a5c7a8608967febcd5c1d2bb02eb40/primitives/io/src/lib.rs#L1716-L1746. Backtrace-rs needs libstd. In addition wasm (which substrate compiles your program to) doesn't allow you to get backtraces anyway. In any case this is not a problem with backtrace-rs. Any crate using libstd would give the same issue.

Any workaround to get backtraces of polkadot??

tauruswei avatar Sep 02 '22 11:09 tauruswei

Unless polkadot provides this functionality, there are none possible. You will have to ask them if such functionality exists.

bjorn3 avatar Sep 02 '22 12:09 bjorn3

Seems like we can't do anything here. Closing.

workingjubilee avatar Jun 22 '23 05:06 workingjubilee