Repository navigation
rust: 1.98.1 -> 1.99.0 (new rustc-1.98.1 rung; arm64 rung builds from the 1.97.1 bedrock) #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| # packages/rustc-1.98.1 | ||||||
|
|
||||||
| Builds rustc 1.98.1 (with cargo and std) from the upstream `rustc-1.98.1-src.tar.xz`, using the | ||||||
| `rustc-1.97.1` package as x.py's stage0, with no network access, and installs it to the private prefix | ||||||
| `/usr/lib/rustc-1.98.1` (`bin/`, `lib/` and `BUILDINFO` only). `packages/rust` consumes that prefix as its | ||||||
| stage0 the same way. | ||||||
|
|
||||||
| ## Stage0 wiring | ||||||
|
|
||||||
| `build.sh` generates `bootstrap.toml` with `[build] rustc`/`cargo` pointing at | ||||||
| `/usr/lib/rustc-1.97.1/bin/{rustc,cargo}`, so x.py uses those binaries instead of downloading the | ||||||
| `src/stage0` snapshot. Before building it asserts the stage0 runs (`--version` contains 1.97.1, | ||||||
| `--print sysroot` equals the prefix) and that the extracted source is the right one | ||||||
| (`src/version` is 1.98.1 and `src/stage0` pins the stage0's version). | ||||||
|
|
||||||
| ## arm64 | ||||||
|
|
||||||
| Unlike the earlier rungs (empty on arm64), this one BUILDS on arm64 too, so that `packages/rust` | ||||||
| 1.99 can take a 1.98.1 stage0 on both arches from the builder instead of a new hand-built prebuilt. | ||||||
| Its arm64 stage0 is the same sha-pinned `rustc-1.97.1-aarch64` bedrock tarball `packages/rust` 1.98.1 | ||||||
| used, extracted to `${BUILDROOT}/rustc-1.97.1-aarch64`; amd64 is unchanged (the rustc-1.97.1 rung). | ||||||
|
|
||||||
| ## Offline mechanism | ||||||
|
|
||||||
| - Crates: the source tarball ships `.cargo/config.toml` redirecting crates-io to its bundled `vendor/`. | ||||||
| - Stage0 download: disabled by the `[build] rustc`/`cargo` pins. | ||||||
| - LLVM: external `llvm-config = /usr/bin/llvm-config` (packages/llvm, LLVM 21) with `[llvm] link-shared`. | ||||||
| - `curl`/`wget`: stubs that exit non-zero and record a tripwire. `git`: a stub that allows local | ||||||
| read-only verbs and fails on network verbs. | ||||||
| - Vendored `curl-sys`/`libssh2-sys`: an empty `.git` marker in each bundled submodule dir keeps | ||||||
| their `build.rs` from running `git submodule update --init`. | ||||||
| - An ambient `.cargo/` above the build root fails the build, since cargo would merge it. | ||||||
|
|
||||||
| ## Gates (run on the installed binaries) | ||||||
|
|
||||||
| 1. `rustc --version` contains 1.98.1. | ||||||
| 2. An rlib is emitted. | ||||||
| 3. Ten std constructs compile and run; the exit code is their computed sum (42), each with its own failure code (111-120). | ||||||
| 4. A proc-macro crate is built as a dylib, loaded and expanded by rustc, and the result runs (42). | ||||||
| 5. cargo builds a proc-macro crate plus a `#[derive]` consumer offline, and the binary runs (42). | ||||||
| 6. `bin/rustc` has a glibc interpreter and the network tripwire is still clean. | ||||||
|
|
||||||
| ## Files | ||||||
|
|
||||||
| | file | role | | ||||||
| |---|---| | ||||||
| | `build.ncl` | spec: stage0 build_dep, source, system LLVM, one `OutputData` glob over `usr/lib/rustc-1.98.1/**`; empty on arm64 | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Remove "empty on arm64" from the Line 47 says the spec is "empty on arm64". Lines 18-21 of this README say this rung builds on arm64. Proposed fix-| `build.ncl` | spec: stage0 build_dep, source, system LLVM, one `OutputData` glob over `usr/lib/rustc-1.98.1/**`; empty on arm64 |
+| `build.ncl` | spec: stage0 build_dep (rustc-1.97.1 rung on amd64, bedrock tarball on arm64), source, system LLVM, one `OutputData` glob over `usr/lib/rustc-1.98.1/**` |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| | `build.sh` | preconditions, offline stubs, submodule markers, `bootstrap.toml`, `x.py build`, install, gates, seal | | ||||||
| | `gatelib.rs`, `gatestd.rs`, `gate_pm.rs`, `gate_pm_use.rs` | readable copies of the gate sources heredoc'd in `build.sh` | | ||||||
| | `rustc-1.98.1.answers` | sha256 pins for `bin/rustc` and `bin/cargo`; none yet, so the seal check is skipped | | ||||||
|
|
||||||
| Per-rung values: `VERSION`/`STAGE0_VERSION` in `build.sh`; `version`, `stage0_version`, the stage0 | ||||||
| import and the Source `sha256` in `build.ncl`; the `.answers` filename and its two pin paths. | ||||||
|
|
||||||
| This rung's newer bootstrap needs four more things to stay offline, all in `build.sh`: | ||||||
| - it bootstraps from a copy of the stage0 with any bundled `rust-src` removed, since x.py would | ||||||
| otherwise compile pre-rename `proc_macro::tracked_env` code against it; | ||||||
| - `bootstrap.toml` sets `build.vendor = false`, `dist.vendor = false`, `dist.src-tarball = false`, | ||||||
| `rust.remap-debuginfo = false` and an explicit `tools` list without `src`; | ||||||
| - bootstrap's `vendor.rs` is patched to skip the generate-copyright vendoring when | ||||||
| `BOOTSTRAP_SKIP_VENDOR` is set (build tooling only, nothing shipped); | ||||||
| - `x.py install` names its components instead of installing everything. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| let { subsetOf, Attrs, BuildSpec, Local, OutputData, Source, .. } = import "minimal.ncl" in | ||
| let { target, .. } = import "config.ncl" in | ||
| # rustc-1.98.1: builds rustc 1.98.1 from the upstream -src tarball with the rustc-1.97.1 package as | ||
| # x.py's stage0, strictly offline, installed to /usr/lib/rustc-1.98.1 (bin/ + lib/ only). | ||
| # packages/rust consumes this rung as its stage0. | ||
| # Same recipe as every rustc-1.9x rung: only version, stage0_version, the stage0 import and the | ||
| # Source sha256 differ in this file; VERSION and STAGE0_VERSION differ in build.sh. See README.md. | ||
| let rustc-1-97-1 = import "../rustc-1.97.1/build.ncl" in # the stage0 (amd64) | ||
| let base = import "../base/build.ncl" in | ||
| let cmake = import "../cmake/build.ncl" in | ||
| let curl = import "../curl/build.ncl" in | ||
| let llvm = import "../llvm/build.ncl" in | ||
| let openssl = import "../openssl/build.ncl" in | ||
| let pkgconf = import "../pkgconf/build.ncl" in | ||
| let python = import "../python/build.ncl" in | ||
| let sqlite = import "../sqlite/build.ncl" in | ||
| let libffi = import "../libffi/build.ncl" in | ||
| let libssh2 = import "../libssh2/build.ncl" in | ||
| let toolchain = import "../toolchain/build.ncl" in | ||
| let gcc = import "../gcc/build.ncl" in | ||
|
|
||
| # pkgmgr: bootstrap_rung = "rust" | ||
| let version = "1.98.1" in | ||
| let stage0_version = "1.97.1" in | ||
| # stage0 by arch. amd64: the rustc-1.97.1 rung. arm64: the rung chain is amd64-only, so take the | ||
| # same sha-pinned rustc-1.97.1 bedrock tarball packages/rust 1.98.1 used; build.sh points at its | ||
| # extracted ./rustc-1.97.1-aarch64. This rung builds on BOTH arches so packages/rust 1.99 gets a | ||
| # 1.98.1 stage0 from the builder on arm64 too, with no new hand-built prebuilt. | ||
| let stage0 = | ||
| match { | ||
| { arch = 'Amd64, .. } => rustc-1-97-1, | ||
| { arch = 'Arm64, .. } => | ||
| { | ||
| url = "gs://minimal-staging-archives/prebuilts/bedrock/sha256/de0724a4bf882c5f4641dc6edd6284ee0fa565a405d4ea264a4f305e3bfe5e6e/rustc-1.97.1-aarch64.tar.zst", | ||
| sha256 = "de0724a4bf882c5f4641dc6edd6284ee0fa565a405d4ea264a4f305e3bfe5e6e", | ||
| extract = true, | ||
| } | Source, | ||
| } target | ||
| in | ||
| let spec = | ||
| { | ||
| name = "rustc-%{version}", | ||
| build_deps = [ | ||
| { file = "build.sh" } | Local, | ||
| { file = "rustc-1.98.1.answers" } | Local, # sha256 pins for the seal check in build.sh; unpinned today | ||
| # The -src tarball ships .cargo/config.toml (crates-io -> vendored-sources) and vendor/, so no | ||
| # cargo-vendor input is needed. build.sh asserts src/version and the src/stage0 pairing. | ||
| { | ||
| url = "gs://minimal-staging-archives/rustc-%{version}-src.tar.xz", | ||
| sha256 = "be1816e7f6c40abb90245ad6e024bed2a7e88d7dda4561e4d5470207df616b9f", | ||
| extract = true, | ||
| strip_prefix = "rustc-%{version}-src", | ||
| } | Source, | ||
| # stage0: the previous rung's installed prefix, /usr/lib/rustc-<stage0_version>/bin/{rustc,cargo} | ||
| # + lib/rustlib/<triple>/lib. build.sh pins bootstrap.toml [build] rustc/cargo at it. | ||
| stage0, | ||
| base, # userland; xz extracts the source | ||
| cmake, # some vendored -sys build scripts; also pulls in a real curl, shadowed by build.sh's stub | ||
| curl, # libcurl for curl-sys (pkg-config path or the marked vendored submodule) | ||
| libssh2, # LIBSSH2_SYS_USE_PKG_CONFIG=1 makes libssh2-sys use the system lib | ||
| pkgconf, # pkg-config for the -sys probes | ||
| python, # x.py | ||
| toolchain, # gcc/binutils/glibc/linux_headers: clang's sysroot | ||
| ], | ||
| runtime_deps = [ | ||
| libffi, | ||
| llvm, # clang, clang++, llvm-config and libLLVM-21.so; also present at build time | ||
| openssl, | ||
| sqlite, | ||
| subsetOf gcc ["libgcc", "libstdcpp"], | ||
| ], | ||
| # no `needs` block: the rung must be strictly offline. | ||
|
|
||
| cmd = "./build.sh", | ||
| outputs = { | ||
| # One recursive OutputData glob over the private prefix: the toolchain is consumed as data by | ||
| # the next rung via absolute path and must not land on /usr/bin. build.sh prunes the prefix | ||
| # to bin/ + lib/ + BUILDINFO so nothing is left uncaptured. | ||
| toolchain = { glob = "usr/lib/rustc-%{version}/**", allow_executable = true } | OutputData, | ||
| }, | ||
|
|
||
| attrs = | ||
| { | ||
| upstream_version = version, | ||
| license_spdx = "MIT OR Apache-2.0", | ||
| source_provenance = { | ||
| category = 'GithubRepo, | ||
| owner = "rust-lang", | ||
| repo = "rust", | ||
| }, | ||
| env_state_wiring = { | ||
| env_var = "CARGO_HOME", | ||
| prefix = "cargo", | ||
| }, | ||
| # system LLVM + clang, comparable to packages/rust | ||
| build_cost_multiple = 4, | ||
| } | Attrs, | ||
| } | BuildSpec | ||
| in | ||
| spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the arm64 stage0 path in "Stage0 wiring".
Lines 10-14 say
bootstrap.tomlalways points at/usr/lib/rustc-1.97.1/bin/{rustc,cargo}, but that is not the actual stage0 path on either arch.build.shLines 47-53 copy the stage0 to${BUILDROOT}/stage0-cleanand pinbootstrap.tomlat that copy. On arm64, the source of that copy is also${BUILDROOT}/rustc-1.97.1-aarch64. Update the section so it matches the script.🤖 Prompt for AI Agents