0

I'm trying to build polkadot-solochain-template with some customizations and got this error:

error[E0152]: found duplicate lang item `panic_impl`
      --> /home/viktor/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sp-io-38.0.0/src/lib.rs:1775:1
       |
  1775 | / pub fn panic(info: &core::panic::PanicInfo) -> ! {
  1776 | |     let message = alloc::format!("{}", info);
  1777 | |     #[cfg(feature = "improved_panic_error_reporting")]
  ...    |
  1786 | | }
       | |_^
       |
       = note: the lang item is first defined in crate `std` (which `once_cell` depends on)
       = note: first definition in `std` loaded from /home/viktor/projects/polkadot-sdk-solochain-template/target/release/wbuild/solochain-template-runtime/target/wasm32-unknown-unknown/release/deps/libstd-61957e3233a6776a.rmeta
       = note: second definition in the local crate (`sp_io`)

  For more information about this error, try `rustc --explain E0152`.
  error: could not compile `sp-io` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

My rustup show:

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/viktor/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2022-03-17-x86_64-apple-darwin
nightly-2022-03-17-x86_64-unknown-linux-gnu
nightly-2022-08-03-x86_64-unknown-linux-gnu
nightly-2022-12-19-x86_64-apple-darwin
nightly-2022-12-19-x86_64-unknown-linux-gnu
nightly-2023-01-09-x86_64-unknown-linux-gnu
nightly-2023-03-25-x86_64-unknown-linux-gnu
nightly-2024-01-08-x86_64-unknown-linux-gnu
nightly-2024-06-21-x86_64-unknown-linux-gnu
nightly-2024-08-30-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.61.0-x86_64-unknown-linux-gnu
1.76.0-x86_64-unknown-linux-gnu
1.81.0-x86_64-unknown-linux-gnu
1.70-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (directory override for '/home/viktor/projects/polkadot-sdk-solochain-template')
rustc 1.85.0-nightly (7c002ff9a 2024-12-25)

I've checked my .toml files and all of my dependencies have default-features = false and included to the [std] section. Also I've added #![cfg_attr(not(feature = "std"), no_std)] to my lib.rs.

What other problem could there be? Maybe I missed something? BTW, I don't have once_cell crate in my dependencies.

0

1 Answer 1

0

The solution for me was to change Cargo.toml in [std] section. I added to all dependencies in [std] section ? like this Changed this pallet-name/std to this pallet-name?/std and after that fixed all errors related to std in dependency.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.