0

I'm trying to build Substrate (https://github.com/paritytech/substrate) after cloning it it with git clone. I'm in the root directory. What am I doing wrong?

Steps to reproduce:

First attempt:

  1. rustup override set nightly-2022-10-20
  2. cargo build
output:
cargo build
   Compiling proc-macro2 v1.0.46
   Compiling unicode-ident v1.0.1
[...]
[...]
[...]
   Compiling substrate-wasm-builder v5.0.0-dev (/home/amab/src/substrate/utils/wasm-builder)
   Compiling kitchensink-runtime v3.0.0-dev (/home/amab/src/substrate/bin/node/runtime)
error: failed to run custom build command for `kitchensink-runtime v3.0.0-dev (/home/amab/src/substrate/bin/node/runtime)`

Caused by:
  process didn't exit successfully: `/home/amab/src/substrate/target/debug/build/kitchensink-runtime-00f6a898772ead1c/build-script-build` (exit status: 1)
  --- stderr
  Rust WASM toolchain not installed, please install it!

  Further error information:
  ------------------------------------------------------------
     Compiling wasm-test v1.0.0 (/tmp/.tmpLkxJdw)
  error[E0463]: can't find crate for `std`
    |
    = note: the `wasm32-unknown-unknown` target may not be installed
    = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`
    = help: consider building the standard library from source with `cargo build -Zbuild-std`

  error: requires `sized` lang_item

  For more information about this error, try `rustc --explain E0463`.
  error: could not compile `wasm-test` due to 2 previous errors
  ------------------------------------------------------------

warning: build failed, waiting for other jobs to finish...

Second attempt:

cargo build
   Compiling unicode-ident v1.0.1
   Compiling proc-macro2 v1.0.46
   Compiling syn v1.0.98
[...]
[...]
[...]
   Compiling sp-runtime-interface-test-wasm v2.0.0 (/home/amab/src/substrate/primitives/runtime-interface/test-wasm)
   Compiling sp-runtime-interface-test-wasm-deprecated v2.0.0 (/home/amab/src/substrate/primitives/runtime-interface/test-wasm-deprecated)
error: failed to run custom build command for `substrate-test-runtime v2.0.0 (/home/amab/src/substrate/test-utils/runtime)`

Caused by:
  process didn't exit successfully: `/home/amab/src/substrate/target/debug/build/substrate-test-runtime-6372ab7d70979471/build-script-build` (exit status: 1)
  --- stderr
  Rust WASM toolchain not installed, please install it!

  Further error information:
  ------------------------------------------------------------
     Compiling wasm-test v1.0.0 (/tmp/.tmpi729zK)
  error[E0463]: can't find crate for `std`
    |
    = note: the `wasm32-unknown-unknown` target may not be installed
    = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`
    = help: consider building the standard library from source with `cargo build -Zbuild-std`

  error: requires `sized` lang_item

  For more information about this error, try `rustc --explain E0463`.
  error: could not compile `wasm-test` due to 2 previous errors
  ------------------------------------------------------------

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `kitchensink-runtime v3.0.0-dev (/home/amab/src/substrate/bin/node/runtime)`

Caused by:
  process didn't exit successfully: `/home/amab/src/substrate/target/debug/build/kitchensink-runtime-00f6a898772ead1c/build-script-build` (exit status: 1)
  --- stderr
  Rust WASM toolchain not installed, please install it!

  Further error information:
  ------------------------------------------------------------
     Compiling wasm-test v1.0.0 (/tmp/.tmpPESiBy)
  error[E0463]: can't find crate for `std`
    |
    = note: the `wasm32-unknown-unknown` target may not be installed
    = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`
    = help: consider building the standard library from source with `cargo build -Zbuild-std`

  error: requires `sized` lang_item

  For more information about this error, try `rustc --explain E0463`.
  error: could not compile `wasm-test` due to 2 previous errors
  ------------------------------------------------------------

^Z  Building [=====================> ] 1154/1205: sp-runtime-interface-test-wasm-deprecated(build.rs), librocksdb-sys(build), sp-runtime-interface-test-wasm(build.rs)    

2 Answers 2

1

First follow the installation guide to be sure you set up the environment property.

Build the code:

cargo build

And run it:

cargo run -- --dev

If you want to run the tests and play with it:

cargo test --all --release

Follow this tutorial to Build a local blockchain running a Substrate template node.

0
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-10-20
cargo +nightly-2022-10-20 run

or

rustup default nightly-2022-10-20
rustup target add wasm32-unknown-unknown
cargo run

Your Answer

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

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