Skip to content

Error when building contract with XCM. #1

@hbulgarini

Description

@hbulgarini

I'm trying to implement this xcm chain extension so we can put a simple contract that sends a XCM call.
The problem i'm facing is when i try to compile the contract with the given Cargo.toml, i get the following errors:

➜  ink git:(master) ✗ cargo +nightly contract build

....

error: the `#[global_allocator]` in ink_allocator conflicts with global allocator in: sp_io

error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `panic_impl`.
  |
  = note: the lang item is first defined in crate `ink_env` (which `flipper` depends on)
  = note: first definition in `ink_env` loaded from /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libink_env-0acca4fc7a95b368.rlib
  = note: second definition in `sp_io` loaded from /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libsp_io-7276ad9650247190.rlib, /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libsp_io-7276ad9650247190.rmeta

error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `oom`.
  |
  = note: the lang item is first defined in crate `ink_allocator` (which `ink_env` depends on)
  = note: first definition in `ink_allocator` loaded from /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libink_allocator-f7c621310e573610.rlib, /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libink_allocator-f7c621310e573610.rmeta
  = note: second definition in `sp_io` loaded from /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libsp_io-7276ad9650247190.rlib, /Users/hectorb/blockchain/pallet-contracts-xcm/ink/target/ink/wasm32-unknown-unknown/release/deps/libsp_io-7276ad9650247190.rmeta

error: could not compile `extension-xcm` due to 3 previous errors

Is there anything i'm not taking into account when building the contract? I have tried with many variants adding the xcm crate dependency from a new project using cargo contract new ..., but the error is the same.

Also it would be nice to know if there is there any working example of this extension where i can take references?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions