Substrate: Build failing on master branch

Created on 19 Feb 2020  路  15Comments  路  Source: paritytech/substrate

When running cargo install --force --git http://github.com/paritytech/substrate subkey, I get the following build error:

error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
   --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes.rs:130:18
    |
130 |             len: bytes.len(),
    |                  ^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `bytes`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `subkey v2.0.0 (http://github.com/paritytech/substrate#dc92587b)`, intermediate artifacts can be found at `/var/folders/bv/lgq40k393ybf6pjnb9ytvwh40000gn/T/cargo-installDQcd6b`

Caused by:
  build failed

Not a rust expert, would appreciate any advice. Looks like a dependency issue or perhaps my dependencies may be out of date.

All 15 comments

What is rust version you are using? You can update it with rustup update.

1.37.0. Using rustup to get up to 1.41.0 and will report back.

@joepetrowski Please have a look & give @jbrukh assistance if he still have issues after upgrading. Thanks.

I am having similar issues, trying to upgrade from an older substrate/subkey for latest edgeware flags.

  • first I got _use of unstable library_ errors and rustup update fixed that
  • next I got _Rust nightly not installed, please install it!_ and rustup toolchain install nightly fixed that
  • now I am getting _Rust WASM toolchain not installed, please install it!_ which seems to be related to https://github.com/paritytech/substrate/issues/3492

I am on OS X Catalina 10.15.2

Can you try running this first?

curl https://getsubstrate.io -sSf | bash -s -- --fast

I just ran that and then

cargo install --force --git https://github.com/paritytech/substrate subkey

And it worked fine.

@joepetrowsk I can't speak for @jbrukh but that is what I've been doing. The first command just updates all my brew packages and then exits.

I've also tried pulling the repo manually and building with cargo. In both cases, I am now stuck on the WASM error.

@joepetrowski I ran again a few times and found there to be some unrelated issues with homebrew that were blocking the script.

It doesn't seem to recognize certain brew exits as errors and unfortunately because it tries to update every single package, even those unrelated to substrate, there is a wide error surface. For instance, in my case there was a breaking change to an ocaml packge. I had to manually remove it and rerun the script and now it works. I never knew previously that the script hadn't finished.

After resolving this issue my build succeeded with cargo install --force --git https://github.com/paritytech/substrate subkey

Thanks.

As a side note, how is subkey versioned? Running subkey --version before and after both show _subkey 2.0.0_ despite the previous version being over 6 months old. Perhaps the commit hash should be included if not using semver.

Versioning will be coming soon. For the last several months, Substrate has been changing so fast that there was no semver, so everything was "pre-2.0". We will be releasing 2.0 shortly though.

I am getting a different build issue on Substrate master, possibly caused by latest nightly rustc 1.43.0-nightly (7760cd0fb 2020-02-19)

   Compiling wasm-bindgen-macro-support v0.2.58
   Compiling wasm-bindgen-macro v0.2.58
   Compiling regex v1.3.4
   Compiling js-sys v0.3.35
   Compiling paste-impl v0.1.6
error[E0603]: struct `Memory` is private
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4873:60
     |
4873 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: struct `Memory` is private
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4898:60
     |
4898 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: struct `Memory` is private
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4908:60
     |
4908 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/xiliangchen/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0603`.
error: could not compile `js-sys`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

I'm getting the same error as @xlc

rustc 1.41.0 (5e1a79984 2020-01-27)
rustc 1.43.0-nightly (7760cd0fb 2020-02-19)

EDIT:
I can confirm that I'm getting a nightly issue.
It builds if I use:

rustc 1.43.0-nightly (5e7af4669 2020-02-16)

Thanks @joepetrowski and thanks @emkman, I went through exactly the same steps and got the same errors. Then I just ran the recommended install command curl https://getsubstrate.io -sSf | bash and got:

Compiling js-sys v0.3.35
error[E0603]: struct `Memory` is private
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4873:60
     |
4873 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: struct `Memory` is private
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4898:60
     |
4898 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: struct `Memory` is private
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:4908:60
     |
4908 |                 let mem = buf.unchecked_ref::<WebAssembly::Memory>();
     |                                                            ^^^^^^ this struct is private
     |
note: the struct `Memory` is defined here
    --> /Users/jbrukh/.cargo/registry/src/github.com-1ecc6299db9ec823/js-sys-0.3.35/src/lib.rs:3516:5
     |
3516 |     #[wasm_bindgen]
     |     ^^^^^^^^^^^^^^^
     = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0603`.
error: could not compile `js-sys`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

warning: build failed, waiting for other jobs to finish...
error: failed to compile `node-cli v2.0.0 (/private/var/folders/bv/lgq40k393ybf6pjnb9ytvwh40000gn/T/tmp.6dCfbyWl/bin/node/cli)`, intermediate artifacts can be found at `/private/var/folders/bv/lgq40k393ybf6pjnb9ytvwh40000gn/T/tmp.6dCfbyWl/target`

Caused by:
  build failed

My goal is to just get the latest version of subkey.

@jbrukh seems to be an issue with latest rust nightly. That install command builds everything. Try:

$ curl https://getsubstrate.io -sSf | bash -s -- --fast
$ rustup install nightly-2020-02-17
$ cargo install --force --git https://github.com/paritytech/substrate subkey

Complementing Joe's answer:

$ curl https://getsubstrate.io -sSf | bash -s -- --fast
$ rustup install nightly-2020-02-17
$ rustup target add wasm32-unknown-unknown --toolchain nightly-2020-02-17
$ cargo +nightly-2020-02-17 install --force --git https://github.com/paritytech/substrate subkey

Thanks @joepetrowski and @riusricardo for the support! This worked for me, so I am resolving the ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pepyakin picture pepyakin  路  5Comments

thiolliere picture thiolliere  路  3Comments

xlc picture xlc  路  5Comments

AurevoirXavier picture AurevoirXavier  路  3Comments

tomaka picture tomaka  路  4Comments