2

I am getting the following errors when building sp_io for our blockchain runtime.

 error[E0152]: found duplicate lang item `panic_impl`
      --> /home/aibrayanov/.cargo/git/checkouts/substrate-7e08433d4c370a21/814752f/primitives/io/src/lib.rs:1633:1
       |
  1633 | pub fn panic(info: &core::panic::PanicInfo) -> ! {
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: the lang item is first defined in crate `std` (which `parity_scale_codec` depends on)
       = note: first definition in `std` loaded from /home/aibrayanov/.rustup/toolchains/nightly-2022-02-19-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-d9a8e4ca4a56d589.rlib
       = note: second definition in the local crate (`sp_io`)

  error[E0152]: found duplicate lang item `oom`
      --> /home/aibrayanov/.cargo/git/checkouts/substrate-7e08433d4c370a21/814752f/primitives/io/src/lib.rs:1649:1
       |
  1649 | pub fn oom(_: core::alloc::Layout) -> ! {
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: the lang item is first defined in crate `std` (which `parity_scale_codec` depends on)
       = note: first definition in `std` loaded from /home/aibrayanov/.rustup/toolchains/nightly-2022-02-19-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-d9a8e4ca4a56d589.rlib
       = note: second definition in the local crate (`sp_io`)

  For more information about this error, try `rustc --explain E0152`.

I tried to enable default-features = std and add#![cfg_attr(not(feature = "std"), no_std)] where relavant but I continue to get the same errors. Here is a copy of my Cargo.toml file (full runtime code can be found here)

[package]
name = "metaverse-runtime-common"
description = "Common code shared between runtimes"
version = "0.0.1"
edition = "2021"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.1", default-features = false, features = ["derive"] }
impl-trait-for-tuples = { version = "0.2.1", default-features = false }
log = { version = "0.4", default-features = false }
num_enum = { version = "0.5.3", default-features = false }
hex-literal = { version = "0.3.1", default-features = false }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
# EVM pallets
pallet-evm = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-ethereum = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-base-fee = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-test-vector-support = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-blake2 = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-bn128 = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-dispatch = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-ed25519 = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-modexp = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }
fp-evm = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.24", default-features = false }

# external crates - orml packages
orml-currencies = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.24", default-features = false }
orml-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.24", default-features = false }
orml-traits = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.24", default-features = false }
orml-nft = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.24", default-features = false }
orml-oracle = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.24", default-features = false }
# metaverse dependencies
primitives = { package = "bit-country-primitives", path = "../../primitives/metaverse", default-features = false }
core-primitives = { path = "../../traits/core-primitives", default-features = false }
auction-manager = { package = "auction-manager", path = "../../traits/auction-manager", default-features = false }
metaverse = { package = "pallet-metaverse", path = "../../pallets/metaverse", default-features = false }
estate = { package = "pallet-estate", path = "../../pallets/estate", default-features = false }
evm-mapping = { package = "pallet-evm-mapping", path = "../../pallets/evm-mapping", default-features = false }
nft = { package = "pallet-nft", path = "../../pallets/nft", version = "2.0.0-rc6", default-features = false }
continuum = { package = "pallet-continuum", path = "../../pallets/continuum", version = "0.0.1", default-features = false }
auction = { package = "pallet-auction", path = "../../pallets/auction", version = "2.0.0-rc6", default-features = false }
currencies = { package = "currencies", path = "../../pallets/currencies", version = "2.0.0-rc6", default-features = false }
mining = { package = "pallet-mining", path = "../../pallets/mining", version = "2.0.0-rc6", default-features = false }
governance = { package = "pallet-governance", path = "../../pallets/governance", version = "2.0.0-rc6", default-features = false }
crowdloan = { package = "pallet-crowdloan", path = "../../pallets/crowdloan", version = "2.0.0-rc6", default-features = false }
economy = { package = "pallet-economy", path = "../../pallets/economy", version = "2.0.0-rc6", default-features = false }
emergency = { package = "pallet-emergency", path = "../../pallets/emergency", version = "2.0.0-rc6", default-features = false }
precompile-utils = { path = "../../primitives/precompiles", default-features = false }
precompile-utils-macro = {path = "../../primitives/precompiles/macro", default-features = false }
[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

[features]
default = ["std"]
std = [
    "pallet-evm/std",
    "fp-evm/std",
    "pallet-ethereum/std",
    "pallet-evm-precompile-blake2/std",
    "pallet-evm-precompile-simple/std",
    "pallet-evm-precompile-bn128/std",
    "pallet-evm-precompile-dispatch/std",
    "pallet-evm-precompile-ed25519/std",
    "pallet-evm-precompile-modexp/std",
    "pallet-evm-precompile-sha3fips/std",
    "orml-currencies/std",
    "orml-tokens/std",
    "orml-nft/std",
    "orml-oracle/std",
    "orml-traits/std",
    "primitives/std",
    "metaverse/std",
    "auction-manager/std",
    "auction/std",
    "estate/std",
    "nft/std",
    "continuum/std",
    "currencies/std",
    "mining/std",
    "evm-mapping/std",
    "governance/std",
    "crowdloan/std",
    "economy/std",
    "emergency/std",
    "precompile-utils/std",
    "sp-io/std",
    "sp-std/std",
    "sp-core/std",
    "sp-runtime/std",
    "pallet-balances/std",
    "pallet-collective/std",
    "pallet-timestamp/std",
    "pallet-scheduler/std",
    "frame-system/std",
    "frame-support/std",
]

1 Answer 1

2

The common cause of this type of error is the leaking of std features.

You should check if sp-io already included in default std (including other dependencies that may use sp-io).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.