mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Markdown linter (#1309)
* Add markdown linting - add linter default rules - adapt rules to current code - fix the code for linting to pass - add CI check fix #1243 * Fix markdown for Substrate * Fix tooling install * Fix workflow * Add documentation * Remove trailing spaces * Update .github/.markdownlint.yaml Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix mangled markdown/lists * Fix captalization issues on known words
This commit is contained in:
@@ -1,22 +1,18 @@
|
||||
---
|
||||
title: Installation
|
||||
---
|
||||
# Installation
|
||||
|
||||
This guide is for reference only, please check the latest information on getting started with Substrate
|
||||
[here](https://docs.substrate.io/main-docs/install/).
|
||||
This guide is for reference only, please check the latest information on getting started with Substrate [here](https://docs.substrate.io/main-docs/install/).
|
||||
|
||||
This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development.
|
||||
Since Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first
|
||||
thing you will need to do is prepare the computer for Rust development - these steps will vary based
|
||||
on the computer's operating system. Once Rust is configured, you will use its toolchains to interact
|
||||
with Rust projects; the commands for Rust's toolchains will be the same for all supported,
|
||||
Unix-based operating systems.
|
||||
This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development. Since
|
||||
Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first thing you will need to do
|
||||
is prepare the computer for Rust development - these steps will vary based on the computer's operating system. Once Rust
|
||||
is configured, you will use its toolchains to interact with Rust projects; the commands for Rust's toolchains will be
|
||||
the same for all supported, Unix-based operating systems.
|
||||
|
||||
## Build dependencies
|
||||
|
||||
Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples
|
||||
in the [Substrate Docs](https://docs.substrate.io) use Unix-style terminals to demonstrate how to
|
||||
interact with Substrate from the command line.
|
||||
Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples in the [Substrate
|
||||
Docs](https://docs.substrate.io) use Unix-style terminals to demonstrate how to interact with Substrate from the command
|
||||
line.
|
||||
|
||||
### Ubuntu/Debian
|
||||
|
||||
@@ -55,10 +51,9 @@ sudo zypper install clang curl git openssl-devel llvm-devel libudev-devel
|
||||
|
||||
### macOS
|
||||
|
||||
> **Apple M1 ARM**
|
||||
> If you have an Apple M1 ARM system on a chip, make sure that you have Apple Rosetta 2
|
||||
> installed through `softwareupdate --install-rosetta`. This is only needed to run the
|
||||
> `protoc` tool during the build. The build itself and the target binaries would remain native.
|
||||
> **Apple M1 ARM** If you have an Apple M1 ARM system on a chip, make sure that you have Apple Rosetta 2 installed
|
||||
> through `softwareupdate --install-rosetta`. This is only needed to run the `protoc` tool during the build. The build
|
||||
> itself and the target binaries would remain native.
|
||||
|
||||
Open the Terminal application and execute the following commands:
|
||||
|
||||
@@ -81,8 +76,8 @@ Please refer to the separate
|
||||
|
||||
## Rust developer environment
|
||||
|
||||
This guide uses <https://rustup.rs> installer and the `rustup` tool to manage the Rust toolchain.
|
||||
First install and configure `rustup`:
|
||||
This guide uses <https://rustup.rs> installer and the `rustup` tool to manage the Rust toolchain. First install and
|
||||
configure `rustup`:
|
||||
|
||||
```bash
|
||||
# Install
|
||||
@@ -102,13 +97,13 @@ rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
|
||||
## Test your set-up
|
||||
|
||||
Now the best way to ensure that you have successfully prepared a computer for Substrate
|
||||
development is to follow the steps in [our first Substrate tutorial](https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/).
|
||||
Now the best way to ensure that you have successfully prepared a computer for Substrate development is to follow the
|
||||
steps in [our first Substrate tutorial](https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/).
|
||||
|
||||
## Troubleshooting Substrate builds
|
||||
|
||||
Sometimes you can't get the Substrate node template
|
||||
to compile out of the box. Here are some tips to help you work through that.
|
||||
Sometimes you can't get the Substrate node template to compile out of the box. Here are some tips to help you work
|
||||
through that.
|
||||
|
||||
### Rust configuration check
|
||||
|
||||
@@ -144,27 +139,27 @@ stable-x86_64-unknown-linux-gnu (default)
|
||||
rustc 1.50.0 (cb75ad5db 2021-02-10)
|
||||
```
|
||||
|
||||
As you can see above, the default toolchain is stable, and the
|
||||
`nightly-x86_64-unknown-linux-gnu` toolchain as well as its `wasm32-unknown-unknown` target is installed.
|
||||
You also see that `nightly-2020-10-06-x86_64-unknown-linux-gnu` is installed, but is not used unless explicitly defined as illustrated in the [specify your nightly version](#specifying-nightly-version)
|
||||
section.
|
||||
As you can see above, the default toolchain is stable, and the `nightly-x86_64-unknown-linux-gnu` toolchain as well as
|
||||
its `wasm32-unknown-unknown` target is installed. You also see that `nightly-2020-10-06-x86_64-unknown-linux-gnu` is
|
||||
installed, but is not used unless explicitly defined as illustrated in the [specify your nightly
|
||||
version](#specifying-nightly-version) section.
|
||||
|
||||
### WebAssembly compilation
|
||||
|
||||
Substrate uses [WebAssembly](https://webassembly.org) (Wasm) to produce portable blockchain
|
||||
runtimes. You will need to configure your Rust compiler to use
|
||||
[`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to allow you to
|
||||
compile Substrate runtime code to the Wasm target.
|
||||
Substrate uses [WebAssembly](https://webassembly.org) (Wasm) to produce portable blockchain runtimes. You will need to
|
||||
configure your Rust compiler to use [`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to
|
||||
allow you to compile Substrate runtime code to the Wasm target.
|
||||
|
||||
> There are upstream issues in Rust that need to be resolved before all of Substrate can use the stable Rust toolchain.
|
||||
> [This is our tracking issue](https://github.com/paritytech/substrate/issues/1252) if you're curious as to why and how this will be resolved.
|
||||
> [This is our tracking issue](https://github.com/paritytech/substrate/issues/1252) if you're curious as to why and how
|
||||
> this will be resolved.
|
||||
|
||||
#### Latest nightly for Substrate `master`
|
||||
|
||||
Developers who are building Substrate _itself_ should always use the latest bug-free versions of
|
||||
Rust stable and nightly. This is because the Substrate codebase follows the tip of Rust nightly,
|
||||
which means that changes in Substrate often depend on upstream changes in the Rust nightly compiler.
|
||||
To ensure your Rust compiler is always up to date, you should run:
|
||||
Developers who are building Substrate _itself_ should always use the latest bug-free versions of Rust stable and
|
||||
nightly. This is because the Substrate codebase follows the tip of Rust nightly, which means that changes in Substrate
|
||||
often depend on upstream changes in the Rust nightly compiler. To ensure your Rust compiler is always up to date, you
|
||||
should run:
|
||||
|
||||
```bash
|
||||
rustup update
|
||||
@@ -172,21 +167,19 @@ rustup update nightly
|
||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
```
|
||||
|
||||
> NOTE: It may be necessary to occasionally rerun `rustup update` if a change in the upstream Substrate
|
||||
> codebase depends on a new feature of the Rust compiler. When you do this, both your nightly
|
||||
> and stable toolchains will be pulled to the most recent release, and for nightly, it is
|
||||
> generally _not_ expected to compile WASM without error (although it very often does).
|
||||
> Be sure to [specify your nightly version](#specifying-nightly-version) if you get WASM build errors
|
||||
> from `rustup` and [downgrade nightly as needed](#downgrading-rust-nightly).
|
||||
> NOTE: It may be necessary to occasionally rerun `rustup update` if a change in the upstream Substrate codebase depends
|
||||
> on a new feature of the Rust compiler. When you do this, both your nightly and stable toolchains will be pulled to the
|
||||
> most recent release, and for nightly, it is generally _not_ expected to compile WASM without error (although it very
|
||||
> often does). Be sure to [specify your nightly version](#specifying-nightly-version) if you get WASM build errors from
|
||||
> `rustup` and [downgrade nightly as needed](#downgrading-rust-nightly).
|
||||
|
||||
#### Rust nightly toolchain
|
||||
|
||||
If you want to guarantee that your build works on your computer as you update Rust and other
|
||||
dependencies, you should use a specific Rust nightly version that is known to be
|
||||
compatible with the version of Substrate they are using; this version will vary from project to
|
||||
project and different projects may use different mechanisms to communicate this version to
|
||||
developers. For instance, the Polkadot client specifies this information in its
|
||||
[release notes](https://github.com/paritytech/polkadot/releases).
|
||||
If you want to guarantee that your build works on your computer as you update Rust and other dependencies, you should
|
||||
use a specific Rust nightly version that is known to be compatible with the version of Substrate they are using; this
|
||||
version will vary from project to project and different projects may use different mechanisms to communicate this
|
||||
version to developers. For instance, the Polkadot client specifies this information in its [release
|
||||
notes](https://github.com/paritytech/polkadot/releases).
|
||||
|
||||
```bash
|
||||
# Specify the specific nightly toolchain in the date below:
|
||||
@@ -203,20 +196,20 @@ rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
|
||||
|
||||
### Specifying nightly version
|
||||
|
||||
Use the `WASM_BUILD_TOOLCHAIN` environment variable to specify the Rust nightly version a Substrate
|
||||
project should use for Wasm compilation:
|
||||
Use the `WASM_BUILD_TOOLCHAIN` environment variable to specify the Rust nightly version a Substrate project should use
|
||||
for Wasm compilation:
|
||||
|
||||
```bash
|
||||
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --release
|
||||
```
|
||||
|
||||
> Note that this only builds _the runtime_ with the specified nightly. The rest of project will be
|
||||
> compiled with **your default toolchain**, i.e. the latest installed stable toolchain.
|
||||
> Note that this only builds _the runtime_ with the specified nightly. The rest of project will be compiled with **your
|
||||
> default toolchain**, i.e. the latest installed stable toolchain.
|
||||
|
||||
### Downgrading Rust nightly
|
||||
|
||||
If your computer is configured to use the latest Rust nightly and you would like to downgrade to a
|
||||
specific nightly version, follow these steps:
|
||||
If your computer is configured to use the latest Rust nightly and you would like to downgrade to a specific nightly
|
||||
version, follow these steps:
|
||||
|
||||
```bash
|
||||
rustup uninstall nightly
|
||||
|
||||
Reference in New Issue
Block a user