fix(build): the early shader preparation's driver links the game's Rust #2588
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2588
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/prep-early-links-rust"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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-compilelink_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 thelifted 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 bothlinks (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 ontocff073a1, which changes no file of this):the_preparation_s_driver_links_the_game_s_rustfails for the bug's reason ("thedriver's link has no liblongshot_rs.a").
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 nosignal 11.
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:
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_CARGOsetting 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
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (build-compile's tests passed in thequeue; CI runs the rest on this head.)
main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
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).
Measurements: the test only sets the existing LONGSHOT_CARGO setting; no switch is added. No check under tests/ reads build-compile's lib.rs.
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.99f9a273f0ce21e4b2f7WIP: fix(build): the early shader preparation's driver links the game's Rustto fix(build): the early shader preparation's driver links the game's Rust