@@ -91,13 +91,23 @@ Validator development builds can take advantage of nightly parallel rustc and fa
9191toolchain file (` rust-toolchain-nightly.toml ` ) sets ` PLATFORM_NIGHTLY_RUSTFLAGS="-Z threads=0" ` , which
9292uses all available CPU threads. If you opt into nightly with ` RUSTUP_TOOLCHAIN=nightly ` or
9393` cargo +nightly ` , set ` PLATFORM_NIGHTLY_RUSTFLAGS ` yourself (for example, ` -Z threads=0 ` or
94- ` -Z threads=8 ` ). To opt out, unset ` PLATFORM_NIGHTLY_RUSTFLAGS ` or set it to an empty string. The
95- ` scripts/verify-nightly-config.sh ` , ` scripts/test-all.sh ` , and ` scripts/test-comprehensive.sh ` helpers
96- respect ` PLATFORM_DISABLE_NIGHTLY=1 ` for a forced opt-out and accept ` PLATFORM_RUST_NIGHTLY=1 ` to force
97- nightly toolchains during scripted checks.
94+ ` -Z threads=8 ` ). To opt out, unset ` PLATFORM_NIGHTLY_RUSTFLAGS ` or set it to an empty string, or set
95+ ` PLATFORM_DISABLE_NIGHTLY=1 ` . The ` scripts/verify-nightly-config.sh ` , ` scripts/test-all.sh ` , and
96+ ` scripts/test-comprehensive.sh ` helpers respect ` PLATFORM_DISABLE_NIGHTLY=1 ` for a forced opt-out and
97+ accept ` PLATFORM_RUST_NIGHTLY=1 ` to force nightly toolchains during scripted checks.
98+
99+ Nightly and linker-related environment variables:
100+
101+ - ` PLATFORM_RUST_NIGHTLY=1 ` : force nightly toolchains in scripts.
102+ - ` PLATFORM_DISABLE_NIGHTLY=1 ` : disable nightly flags even on nightly.
103+ - ` PLATFORM_NIGHTLY_RUSTFLAGS ` : nightly-only rustc flags (for example, ` -Z threads=0 ` ).
104+ - ` PLATFORM_FAST_LINKER_RUSTFLAGS ` : opt-in fast-linker flags for Linux.
105+ - ` PLATFORM_FAST_LINKER_RUSTFLAGS_DARWIN ` : opt-in fast-linker flags for macOS.
106+ - ` PLATFORM_LINKER_RUSTFLAGS ` : explicit linker flags for Linux (override fast-linker defaults).
107+ - ` PLATFORM_LINKER_RUSTFLAGS_DARWIN ` : explicit linker flags for macOS (override fast-linker defaults).
108+ - ` PLATFORM_DISABLE_FAST_LINKER=1 ` : disable fast-linker flags in scripts.
98109
99110Supported fast linkers:
100-
101111- ** Linux** : ` mold ` , ` lld `
102112- ** macOS** : ` lld ` , ` zld `
103113
@@ -117,12 +127,32 @@ export PLATFORM_FAST_LINKER_RUSTFLAGS="-C link-arg=-fuse-ld=mold"
117127cargo build
118128```
119129
120- Opt out of fast linker flags by unsetting ` PLATFORM_FAST_LINKER_RUSTFLAGS ` /
121- ` PLATFORM_FAST_LINKER_RUSTFLAGS_DARWIN ` , setting ` PLATFORM_LINKER_RUSTFLAGS ` (Linux) /
122- ` PLATFORM_LINKER_RUSTFLAGS_DARWIN ` (macOS) to an empty string, or exporting
123- ` PLATFORM_DISABLE_FAST_LINKER=1 ` for scripted runs. To override defaults explicitly, set
124- ` PLATFORM_LINKER_RUSTFLAGS ` (Linux) or ` PLATFORM_LINKER_RUSTFLAGS_DARWIN ` (macOS); these override the
125- opt-in fast-linker values when present.
130+ Fast linker prerequisites (Ubuntu/Debian):
131+
132+ ``` bash
133+ sudo apt-get update
134+ sudo apt-get install -y mold
135+ # or
136+ sudo apt-get install -y lld
137+ ```
138+
139+ Fast linker prerequisites (macOS):
140+
141+ ``` bash
142+ brew install llvm
143+ brew install zld
144+ ```
145+
146+ Example: faster build/test runs with nightly + linker selection:
147+
148+ ``` bash
149+ export RUSTUP_TOOLCHAIN=nightly
150+ export PLATFORM_NIGHTLY_RUSTFLAGS=" -Z threads=0"
151+ export PLATFORM_FAST_LINKER_RUSTFLAGS=" -C link-arg=-fuse-ld=mold"
152+
153+ cargo build --release --bin validator-node
154+ cargo test
155+ ```
126156
127157### Bittensor
128158
@@ -218,6 +248,13 @@ sudo apt-get install -y mold
218248sudo apt-get install -y lld
219249```
220250
251+ Install a fast linker (macOS):
252+
253+ ``` bash
254+ brew install llvm
255+ brew install zld
256+ ```
257+
221258To opt out for tests, export ` PLATFORM_DISABLE_NIGHTLY=1 ` (disable nightly flags) and/or
222259` PLATFORM_DISABLE_FAST_LINKER=1 ` (disable fast linker flags). To override Linux/macOS linker flags
223260explicitly, set ` PLATFORM_LINKER_RUSTFLAGS ` or ` PLATFORM_LINKER_RUSTFLAGS_DARWIN ` .
0 commit comments