The scripts allow building a substrate node for amd64, aarch64(armv8 64bit) architectures.
mkdir git
git clone https://github.com/paritytech/polkadot-sdk.git git/polkadot-sdk
./build-env.sh bullseye aarch64
./build-env.sh bullseye amd64
./build-env.sh buster aarch64
./build-env.sh buster amd64
./run-env.sh bullseye amd64
cd /git/polkadot-sdk/polkadot
cargo build --release
exit
You can find results in cargo_target_debian_*_*
folders.
print all available CPUs
rustc --target x86_64-unknown-linux-gnu --print target-cpus
rustc --target aarch64-unknown-linux-gnu --print target-cpus
Print the optimizations for CPUs
rustc --target x86_64-unknown-linux-gnu -C target-cpu=x86-64-v3 --print cfg
rustc --target aarch64-unknown-linux-gnu -C target-cpu=apple-m1 --print cfg
# Print the optimizations for your CPU
rustc -C target-cpu=native --print cfg
Build a binary that optimized for CPUs
RUSTFLAGS='-C target-cpu=x86-64-v3' cargo build --release --target x86_64-unknown-linux-gnu
RUSTFLAGS='-C target-cpu=cortex-a72' cargo build --release --target aarch64-unknown-linux-gnu
# Build a binary that optimized for your CPU
RUSTFLAGS='-C target-cpu=native' cargo build --release --target x86_64-unknown-linux-gnu
Build an optimzed binary with debug symbols
cargo build --profile testnet