Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

frame-support build fails with latest rust nightly-2020-05-26 #6167

Closed
mnaamani opened this issue May 27, 2020 · 12 comments
Closed

frame-support build fails with latest rust nightly-2020-05-26 #6167

mnaamani opened this issue May 27, 2020 · 12 comments

Comments

@mnaamani
Copy link
Contributor

cargo build --release

Compiler error building WASM runtime with latest nightly-2020-05-26

error[E0424]: expected value, found module `self`
   --> /Users/mokhtar/joystream/substrate/frame/support/src/traits.rs:913:11
    |
911 | / bitmask! {
912 | |     /// Reasons for moving funds out of an account.
913 | |     #[derive(Encode, Decode)]
    | |              ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter
914 | |     pub mask WithdrawReasons: i8 where
...   |
929 | |     }
930 | | }
    | |_- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
    |
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0424`.
error: could not compile `frame-support`.

Reverting to earlier version of nightly from a few days prior does not show same error.

@duval1024
Copy link

stable version 1.43.1 (8d69840ab 2020-05-04) also show the same error :

   Compiling frame-support v2.0.0-rc2 (/Users/duval/workspace/blockchain/substrate/frame/support)
error[E0424]: expected value, found module `self`
   --> /Users/duval/workspace/blockchain/substrate/frame/support/src/traits.rs:913:11
    |
911 | / bitmask! {
912 | |     /// Reasons for moving funds out of an account.
913 | |     #[derive(Encode, Decode)]
    | |              ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter
914 | |     pub mask WithdrawReasons: i8 where
...   |
929 | |     }
930 | | }
    | |_- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
    |
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0424`.
error: could not compile `frame-support`.

~/workspace/blockchain/substrate   master  rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/duval/.rustup

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

stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
1.12.0-x86_64-apple-darwin
1.43.1-x86_64-apple-darwin

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

stable-x86_64-apple-darwin (default)
rustc 1.43.1 (8d69840ab 2020-05-04)


@duval1024
Copy link

duval1024 commented May 29, 2020

I reinstalled all installed toolchains , and then fixed this problem.

@bkchr
Copy link
Member

bkchr commented May 31, 2020

This is fixed by this pr: rust-lang/rust#72724

Installing rust nightly rustc 1.45.0-nightly (74e804683 2020-05-30) fixes it.

We also merged a pr to fix the underlying bug, so, if the feature is re-added to the compiler we should not run into the same problems.

@bkchr bkchr closed this as completed May 31, 2020
@danforbes
Copy link
Contributor

For people following our tutorials, will this problems always be present in Substrate v2.0.0-rc2? If so I can update the instructions for that version of the tutorial to add an extra step to make sure you're on the correct nightly. I guess I'm unclear if this is an ephemeral upstream issue with Rust or if this is something that will always be the case on v2.0.0-rc.

@bkchr
Copy link
Member

bkchr commented May 31, 2020

No, the compiler reverted the code that lead to this compilation error. Until the code is re-added, the tutorial should work without any problems.

@JoshOrndorff
Copy link
Contributor

A tutorial user reported the same error in sp-consensus-babe when trying to build subkey. polkadot-developers/tutorials#53

I know the compiler itself reverted so this is not an immediate problem anymore, but I wonder if the underlying issue in sp-consensus-babe was fixed as @bkchr described for the one in frame-support

We also merged a pr to fix the underlying bug, so, if the feature is re-added to the compiler we should not run into the same problems.

@brenzi
Copy link
Contributor

brenzi commented Sep 9, 2020

I'm struggling with this for rc5:

     Compiling frame-support v2.0.0-rc5
  error[E0424]: expected value, found module `self`
      --> /home/abrenzikofer/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/frame-support-2.0.0-rc5/src/traits.rs:1184:11
       |
  1182 | / bitmask! {
  1183 | |     /// Reasons for moving funds out of an account.
  1184 | |     #[derive(Encode, Decode)]
       | |              ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter
  1185 | |     pub mask WithdrawReasons: i8 where
  ...    |
  1200 | |     }
  1201 | | }
       | |_- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
       |
       = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

I uninstalled all my toolchains and re-ran

rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly

my rustup show

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/<_>/.rustup

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

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

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

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

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

stable-x86_64-unknown-linux-gnu (default)
rustc 1.46.0 (04488afe3 2020-08-24)

@danforbes
Copy link
Contributor

@brenzi can you try using the nightly from July 24th? That was the date rc5 was released. There are some example commands here https://substrate.dev/substrate-contracts-workshop/#/0/setup

@brenzi
Copy link
Contributor

brenzi commented Sep 9, 2020

hm, that nightly won't install because of missing cargo fmt. but that one works:

rustup toolchain install nightly-2020-07-12

however, the wasm builder decides on its own what toolchain to use, right? so it is of no use to do

cargo +nightly-2020-07-12 build --release

right?

@brenzi
Copy link
Contributor

brenzi commented Sep 9, 2020

cargo +nightly-2020-07-12 build --release

works

@bkchr suggested

cargo update -p parity-scale-codec-derive

which makes it work with stable too.

@peterwillcn
Copy link

peterwillcn commented Sep 12, 2020

rustup toolchain install nightly-2020-07-12
cargo +nightly-2020-07-12 build --release fix it

@srinjoychakravarty
Copy link

srinjoychakravarty commented Sep 23, 2020

Thanks guys...
Latest fix [more detailed]:

  1. Install the latest toolchain
    $ rustup toolchain install nightly-2020-07-12

  2. List your rust toolchains and see which one is active
    $ rustup show

  3. Make the latest nightly toolchain the active one
    $ rustup default nightly-2020-07-12-x86_64-unknown-linux-gnu

  4. Ensure web assembly compilation is bound to the latest toolchain [activated above]
    $ rustup target add wasm32-unknown-unknown --toolchain nightly-2020-07-12

  5. Update the substrate codec for encoding/decoding rust data types [optional]
    $ cargo update -p parity-scale-codec-derive_

  6. Compile the ink smart contract in verbose mode so you have better insights into the successful compilation
    $ cargo +nightly-2020-07-12 build --release --verbose

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants