paritytech / canvas

Node implementation for Canvas ‒ a Substrate parachain for smart contracts.
GNU General Public License v3.0
68 stars 21 forks source link

"multiple `intersperse` found"-Error when installing canvas-node #75

Closed takahser closed 2 years ago

takahser commented 3 years ago

When installing canvas node using

cargo install canvas-node --git https://github.com/paritytech/canvas-node.git --tag v0.1.9 --force --locked

It fails with the following error:

error[E0034]: multiple applicable items in scope
   --> /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-derive-0.7.0/src/lib.rs:109:14
    |
109 |             .intersperse(quote!(|));
    |              ^^^^^^^^^^^ multiple `intersperse` found
    |
    = note: candidate #1 is defined in an impl of the trait `Iterator` for the type `Map<I, F>`
    = note: candidate #2 is defined in an impl of the trait `Itertools` for the type `T`
help: disambiguate the associated function for candidate #1
    |
105 ~         let tags = Iterator::intersperse(field
106 +             .tags()
107 +             .into_iter()
108 +             .map(|tag| quote!(#tag)), {
109 +         let mut _s = $crate::__private::TokenStream::new();
110 +         $crate::quote_each_token!(_s $($tt)*);
  ...
help: disambiguate the associated function for candidate #2
    |
105 ~         let tags = Itertools::intersperse(field
106 +             .tags()
107 +             .into_iter()
108 +             .map(|tag| quote!(#tag)), {
109 +         let mut _s = $crate::__private::TokenStream::new();
110 +         $crate::quote_each_token!(_s $($tt)*);
  ...

For more information about this error, try `rustc --explain E0034`.
error: could not compile `prost-derive` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `europa v0.3.2 (https://github.com/patractlabs/europa.git#f6da65d2)`, intermediate artifacts can be found at `/var/folders/qt/_kwnr6197b120zf0302c_p7r0000gn/T/cargo-installJ7sHVi`

Caused by:
  build failed

It seems like the compiler is unable to distinguish the two interperse functions that are located in different namespaces: Iterator::intersperse and Itertools::intersperse. Although in the prost-derive downstream package only the Itertools lib is imported. I'm new to Rust so I'm not sure why this is happening.

cmichi commented 3 years ago

@takahser Thanks for the report! Could you try with v0.1.10 and the latest Rust nightly?

rustup override set nightly
rustup update
cargo install canvas-node --git https://github.com/paritytech/canvas-node.git --tag v0.1.10 --force --locked

Does it work then?

takahser commented 3 years ago

@cmichi Thanks for reaching out. Unfortunately I get the same results when running these.

cmichi commented 3 years ago

@takahser Just noticed this in the error message which you posted above:

error: failed to compile `europa v0.3.2 (https://github.com/patractlabs/europa.git#f6da65d2)`, intermediate artifacts can be found at `/var/folders/qt/_kwnr6197b120zf0302c_p7r0000gn/T/cargo-installJ7sHVi`

This project europa is unrelated to this one here, are you sure that you're installing canvas-node? If yes I suggest to remove your registry folder /Users/xxx/.cargo/registry/ and try again.

takahser commented 3 years ago

@cmichi Ah sorry, I posted the wrong one. The very same error happens for both packages canvas-node and europa:

   --> /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-derive-0.7.0/src/lib.rs:109:14
    |
109 |             .intersperse(quote!(|));
    |              ^^^^^^^^^^^ multiple `intersperse` found
    |
    = note: candidate #1 is defined in an impl of the trait `Iterator` for the type `Map<I, F>`
    = note: candidate #2 is defined in an impl of the trait `Itertools` for the type `T`
help: disambiguate the associated function for candidate #1
    |
105 ~         let tags = Iterator::intersperse(field
106 +             .tags()
107 +             .into_iter()
108 +             .map(|tag| quote!(#tag)), {
109 +         let mut _s = $crate::__private::TokenStream::new();
110 +         $crate::quote_each_token!(_s $($tt)*);
  ...
help: disambiguate the associated function for candidate #2
    |
105 ~         let tags = Itertools::intersperse(field
106 +             .tags()
107 +             .into_iter()
108 +             .map(|tag| quote!(#tag)), {
109 +         let mut _s = $crate::__private::TokenStream::new();
110 +         $crate::quote_each_token!(_s $($tt)*);
  ...

   Compiling enum-as-inner v0.3.3
For more information about this error, try `rustc --explain E0034`.
error: could not compile `prost-derive` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `canvas-node v0.1.0 (https://github.com/paritytech/canvas-node.git?tag=v0.1.10#25fd60fe)`, intermediate artifacts can be found at `/var/folders/qt/_kwnr6197b120zf0302c_p7r0000gn/T/cargo-installA80NCB`

Caused by:
  build failed

I tried removing the registry but the issue persists.

mmagician commented 3 years ago

Getting the same error here on Mac OS as well as Ubuntu 18.04.

cmichi commented 3 years ago

Also with master? I can build all fine locally.

cargo install canvas-node --git https://github.com/paritytech/canvas-node.git  --force

Alternatively you can download one of the binary releases in the meantime: https://github.com/paritytech/canvas-node/releases/tag/v0.1.10. They're available for Mac OS, as well as Linux.

mmagician commented 3 years ago

Yeah, also failed with master from source for me.

cmichi commented 3 years ago

So I just tried it with rustup override set nightly-2021-08-13 and I can run the node there, it's some issue with the current nightly. If you execute that command and run again it should work.

mmagician commented 3 years ago

Ok, that worked for me. Thanks for the fix!

mmagician commented 3 years ago

@cmichi Would it make sense to include a rust-toolchain file in the repo, with the latest known working nightly version?

HCastano commented 2 years ago

Gonna close this since we've bumped prost after bumping Substrate.

@cmichi Would it make sense to include a rust-toolchain file in the repo, with the latest known working nightly version?

@mmagician I don't think so, since it's just assumed (on our end anyways) that you should be using the latest nightly, so the toolchain file would end up being a pain to keep up to date.

I'm open to it if there are some good arguments for including it though.