fix(build): the early shader preparation's driver links the game's Rust #2588

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/prep-early-links-rust into main 2026-11-26 02:46:11 +00:00
Owner

Summary

On Linux, a build whose game folder starts with empty caches (a player's first build, or a build after the caches are
deleted) links the shader preparation's driver early, beside the compile, so shaders prepare while the game still
compiles (build-driver shaders::Early, build-compile link_prepare). Since #2411 the game links its Rust
(liblongshot_rs.a), but that early link leaves it out: every Rust function the host calls resolves to one of the
lifted game's stand-ins, 256 zero bytes of data. The driver's first call into one crashes it with SIGSEGV, twice, and
the build says "The shaders were not prepared now (the game was stopped by signal 11)"; the game then prepares them at
its first start instead, which is the long wait the early path exists to avoid.

No nightly contains #2411 yet, so no player build has shipped this, but the next nightly would, for every Linux
player's first build. Windows doesn't take the early path.

How to see it on main: a Linux build into a new game folder, with shader preparation on. The build log says "linked
early", then the signal 11 line.

The fix gives the driver's link the game's Rust as the game's own link has it: one function, rust_link, for both
links (the tree's prebuilt library, else cargo's build), plus the system libraries Rust's standard library needs. The
stand-ins' log line now names the first of them, so a called stand-in can be told apart from the rest.

Read first: builder/crates/build-compile/src/lib.rs (link_prepare, rust_link).

Testing

Tested: Linux (CachyOS), RTX 3090, through the PC's job queue, on this branch's commits (main fd68f82c; rebased onto cff073a1, which changes no file of this):

  • The test before the fix: the_preparation_s_driver_links_the_game_s_rust fails for the bug's reason ("the
    driver's link has no liblongshot_rs.a").
  • With the fix: build-compile passes in full, 48 + 18 tests including the new one.
  • A cold first build into new folders with no profile: rc 0 in 137 s. The log has "the renderer and the shader
    preparation's driver linked early (7.1s): the preparation starts". The driver needed 20 stand-ins, all lifted-game
    names (a64_fn_*, hos_entry_*, hos_image_*), none for Rust. It "prepared beside the compile in 96 s", with no
    signal 11.
  • In the game: booted to play at Kokiri Forest in 16.3 s, 600 frames, quit cleanly (v3.2.0-36-g58692c72a).

The program cache started from the shader store's copy, but the game folder was cold, and the game folder is what
decides the early path.

Still to test:

  • None. Windows doesn't link early, so this changes nothing there.

Measurements

Nothing to measure: a crash fix. The early path's timing is unchanged; it now finishes instead of crashing. No switch is added: the new test sets the existing LONGSHOT_CARGO setting to its fake cargo.

Risks

The early driver's link now includes the game's Rust library and Rust's system libraries, as the game's own link
already does. If that link failed, the build would fall back to preparing at the game's first start, as it does today
after the crash. Nothing changes for players after updating; a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (build-compile's tests passed in the
    queue; CI runs the rest on this head.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY

## Summary On Linux, a build whose game folder starts with empty caches (a player's first build, or a build after the caches are deleted) links the shader preparation's driver early, beside the compile, so shaders prepare while the game still compiles (build-driver `shaders::Early`, build-compile `link_prepare`). Since #2411 the game links its Rust (`liblongshot_rs.a`), but that early link leaves it out: every Rust function the host calls resolves to one of the lifted game's stand-ins, 256 zero bytes of data. The driver's first call into one crashes it with SIGSEGV, twice, and the build says "The shaders were not prepared now (the game was stopped by signal 11)"; the game then prepares them at its first start instead, which is the long wait the early path exists to avoid. No nightly contains #2411 yet, so no player build has shipped this, but the next nightly would, for every Linux player's first build. Windows doesn't take the early path. How to see it on main: a Linux build into a new game folder, with shader preparation on. The build log says "linked early", then the signal 11 line. The fix gives the driver's link the game's Rust as the game's own link has it: one function, `rust_link`, for both links (the tree's prebuilt library, else cargo's build), plus the system libraries Rust's standard library needs. The stand-ins' log line now names the first of them, so a called stand-in can be told apart from the rest. Read first: `builder/crates/build-compile/src/lib.rs` (`link_prepare`, `rust_link`). ## Testing **Tested:** Linux (CachyOS), RTX 3090, through the PC's job queue, on this branch's commits (main fd68f82c; rebased onto cff073a1, which changes no file of this): - **The test before the fix:** `the_preparation_s_driver_links_the_game_s_rust` fails for the bug's reason ("the driver's link has no liblongshot_rs.a"). - **With the fix:** build-compile passes in full, 48 + 18 tests including the new one. - **A cold first build** into new folders with no profile: rc 0 in 137 s. The log has "the renderer and the shader preparation's driver linked early (7.1s): the preparation starts". The driver needed 20 stand-ins, all lifted-game names (`a64_fn_*`, `hos_entry_*`, `hos_image_*`), none for Rust. It "prepared beside the compile in 96 s", with no signal 11. - **In the game:** booted to play at Kokiri Forest in 16.3 s, 600 frames, quit cleanly (v3.2.0-36-g58692c72a). The program cache started from the shader store's copy, but the game folder was cold, and the game folder is what decides the early path. **Still to test:** - None. Windows doesn't link early, so this changes nothing there. ## Measurements Nothing to measure: a crash fix. The early path's timing is unchanged; it now finishes instead of crashing. No switch is added: the new test sets the existing `LONGSHOT_CARGO` setting to its fake cargo. ## Risks The early driver's link now includes the game's Rust library and Rust's system libraries, as the game's own link already does. If that link failed, the build would fall back to preparing at the game's first start, as it does today after the crash. Nothing changes for players after updating; a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). *(build-compile's tests passed in the queue; CI runs the rest on this head.)* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
A Linux build whose game folder's caches start from nothing (a player's first build: build-driver shaders::Early)
links the shader preparation's driver early, beside the compile (build-compile link_prepare). The game has linked its
Rust (liblongshot_rs.a) since #2411, but that link leaves it out, so every Rust function the host calls is one of the
lifted game's stand-ins, 256 zero bytes of data. The driver's first call into one stops it with SIGSEGV before its
first line of log, twice, and the build says "The shaders were not prepared now (the game was stopped by signal 11)";
the game then prepares them at its first start.

build-compile's the_preparation_s_driver_links_the_game_s_rust links the driver of a tree with Rust, with a cargo that
writes its library and a compiler that writes down its command, and asks for the library on it. It fails here: the
command has no liblongshot_rs.a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
fix(build): the early shader preparation's driver links the game's Rust
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 12s
CI / Third-party parts and guide screenshots (pull_request) Successful in 15s
PR description / Title and description (pull_request_target) Successful in 8s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 21s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m58s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 4m8s
CI / Website build and checks (pull_request) Successful in 1m51s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
99f9a273f0
The driver's link (build-compile link_prepare) now has the game's Rust as the game's own link has it: rust_link, one
function for both links (the tree's prebuilt library of its sources, else cargo's build), and the system libraries its
standard library needs. Before, a Linux player's first build stopped the early preparation with signal 11 (the host's
first call into the Rust reached a stand-in, data). The stand-ins' log line now names the first of them, so a called
stand-in can be told apart from the rest.

Test: build-compile's the_preparation_s_driver_links_the_game_s_rust passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
Author
Owner

Tested in game: Linux (CachyOS), RTX 3090: a cold first build took the early prep path ('linked early'), prepared beside the compile in 96 s without the signal 11, and the game booted to play at Kokiri Forest (600 frames, clean quit).

Tested in game: Linux (CachyOS), RTX 3090: a cold first build took the early prep path ('linked early'), prepared beside the compile in 96 s without the signal 11, and the game booted to play at Kokiri Forest (600 frames, clean quit).
Author
Owner

Measurements: the test only sets the existing LONGSHOT_CARGO setting; no switch is added. No check under tests/ reads build-compile's lib.rs.

Measurements: the test only sets the existing LONGSHOT_CARGO setting; no switch is added. No check under tests/ reads build-compile's lib.rs.
Author
Owner

Rebased onto main 8bd104aa (the CI rework, #2568; no file of this PR's touched). The Lint job failed after 21 s on the old head, while main's own Lint passes and pre-commit passes locally on both changed files (gitleaks included), so this reruns it on the current CI.

Rebased onto main 8bd104aa (the CI rework, #2568; no file of this PR's touched). The Lint job failed after 21 s on the old head, while main's own Lint passes and pre-commit passes locally on both changed files (gitleaks included), so this reruns it on the current CI.
HumanBean force-pushed fix/prep-early-links-rust from 99f9a273f0
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 12s
CI / Third-party parts and guide screenshots (pull_request) Successful in 15s
PR description / Title and description (pull_request_target) Successful in 8s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 21s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m58s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 4m8s
CI / Website build and checks (pull_request) Successful in 1m51s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
to ce21e4b2f7
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 15s
CI / Third-party parts and guide screenshots (pull_request) Successful in 19s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m27s
PR description / Title and description (pull_request_target) Failing after 15s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m30s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m45s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 5m39s
CI / Website build and checks (pull_request) Successful in 5m13s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 33m55s
2026-11-26 02:20:35 +00:00
Compare
HumanBean changed title from WIP: fix(build): the early shader preparation's driver links the game's Rust to fix(build): the early shader preparation's driver links the game's Rust 2026-11-26 02:45:53 +00:00
HumanBean deleted branch fix/prep-early-links-rust 2026-11-26 02:46:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2588
No description provided.