WIP: fix(builder): the release's builder links its C++ runtime in again: longshot_builder.py build's flags are whole #2824

Draft
llun wants to merge 2 commits from llun/Longshot:fix/mod-api-builder-flags into mod-api
Member

Summary

For #2822 (into mod-api). scripts/longshot_builder.py build, which makes the release's builder, adds glslang's C++ runtime to rustc's flags with flags += " -C link-arg=-l:libc++.a -C link-arg=-l:libc++abi.a" (Windows) and flags += " -C link-arg=-l:libstdc++.a" (Linux). flags is a list since #2732, so the string goes in one character at a time: CARGO_ENCODED_RUSTFLAGS holds " ", "-", "C", " ", "l", ... and the link-args never reach rustc as flags. This adds them as list items, like the rest of the function's flags.

Read first: cmd_build in scripts/longshot_builder.py.

Testing

Tested: Windows 11, mise run test -- test_longshot_builder. The check now looks for the C++ runtime's link-args, each one whole, and asks that no flag is a single character. It fails on mod-api @ eaf4a48b (['-C', 'link-arg=-l:libc++.a'] not found in [... [' ', '-'], ['-', 'C'] ...], the same on the Linux side with -l:libstdc++.a) and passes here. mise run lint passes.

Still to test:

  • Release CI: build the release's builder for windows-x64 and linux-x64 with scripts/longshot_builder.py build, expecting it to link with glslang's C++ runtime static and pass check (by hand, a maintainer: it needs the pinned toolchain's download)

Measurements

Verdict: fixed. The release's C++ runtime link-args reach rustc whole: the check fails on mod-api and passes here.

Baseline: mod-api (#2822's head), the branch this PR goes into: the bug is there, not on main.

Setup: Windows 11, mise run test -- test_longshot_builder (its Windows and Linux cases, with longshot_builder.py build's cargo run stood in). The game and a build's speed are not affected: only the flags change.

Before: mod-api @ eaf4a48b After: this PR @ 3628cf9a
tests/test_longshot_builder.py FAIL: ['-C', 'link-arg=-l:libc++.a'] not found (the flags ' ', '-', 'C', ... one character each) pass

Risks

The sandbox: not touched. This is the release's build script for the builder: it links the builder's own C++ runtime in. What the builder confines, grants and serves to the game is the same code.

Only the release's longshot_builder.py build changes: its C++ runtime flags now reach rustc. A revert is enough. Players notice nothing.

Checklist

Ready for review

  • One topic, on current mod-api (#2822's head); the title is a Conventional Commit.
  • Tested on my own PC, as Testing says (a script and its check: no game run).
  • mise run test passes (any failure that also fails on main is named). (This check passes. The whole suite on mod-api has Windows-only failures, which another PR into mod-api fixes.)
  • 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. (It fails on mod-api, where the bug is.)
  • 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

## Summary For [#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822) (into `mod-api`). `scripts/longshot_builder.py build`, which makes the release's builder, adds glslang's C++ runtime to rustc's flags with `flags += " -C link-arg=-l:libc++.a -C link-arg=-l:libc++abi.a"` (Windows) and `flags += " -C link-arg=-l:libstdc++.a"` (Linux). `flags` is a list since [#2732](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2732), so the string goes in one character at a time: `CARGO_ENCODED_RUSTFLAGS` holds `" "`, `"-"`, `"C"`, `" "`, `"l"`, ... and the link-args never reach rustc as flags. This adds them as list items, like the rest of the function's flags. Read first: `cmd_build` in `scripts/longshot_builder.py`. ## Testing **Tested:** Windows 11, `mise run test -- test_longshot_builder`. The check now looks for the C++ runtime's link-args, each one whole, and asks that no flag is a single character. It fails on `mod-api` @ eaf4a48b (`['-C', 'link-arg=-l:libc++.a'] not found in [... [' ', '-'], ['-', 'C'] ...]`, the same on the Linux side with `-l:libstdc++.a`) and passes here. `mise run lint` passes. **Still to test:** - Release CI: build the release's builder for windows-x64 and linux-x64 with `scripts/longshot_builder.py build`, expecting it to link with glslang's C++ runtime static and pass `check` (by hand, a maintainer: it needs the pinned toolchain's download) ## Measurements **Verdict:** fixed. The release's C++ runtime link-args reach rustc whole: the check fails on `mod-api` and passes here. Baseline: `mod-api` (#2822's head), the branch this PR goes into: the bug is there, not on `main`. Setup: Windows 11, `mise run test -- test_longshot_builder` (its Windows and Linux cases, with `longshot_builder.py build`'s cargo run stood in). The game and a build's speed are not affected: only the flags change. | | Before: mod-api @ eaf4a48b | After: this PR @ 3628cf9a | |---|---|---| | `tests/test_longshot_builder.py` | FAIL: `['-C', 'link-arg=-l:libc++.a'] not found` (the flags `' '`, `'-'`, `'C'`, ... one character each) | pass | ## Risks **The sandbox:** not touched. This is the release's build script for the builder: it links the builder's own C++ runtime in. What the builder confines, grants and serves to the game is the same code. Only the release's `longshot_builder.py build` changes: its C++ runtime flags now reach rustc. A revert is enough. Players notice nothing. ## Checklist ### Ready for review - [x] One topic, on current `mod-api` (#2822's head); the title is a Conventional Commit. - [x] Tested on my own PC, as Testing says (a script and its check: no game run). - [ ] `mise run test` passes (any failure that also fails on `main` is named). (This check passes. The whole suite on `mod-api` has Windows-only failures, which another PR into `mod-api` fixes.) - [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. (It fails on `mod-api`, where the bug is.) - [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)
feat(game)!: the game side and the whole mod API in Rust, with system mods and the sandbox on by default
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 28s
PR description / Title and description (pull_request_target) Successful in 47s
CI / What the change needs (pull_request) Successful in 2m21s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m48s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
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
CI / Website build and checks (pull_request) Has been cancelled
9e6b9c5782
The game side (between the C host and the lifted game) and the mod API move from C to Rust (game/crates), every game
setting and feature becomes a system mod (game/mods, Rust or TypeScript), and longshot-builder becomes the game's only
entrypoint, its sandboxer (Landlock and seccomp on Linux, an AppContainer on Windows) and its broker over one framed
channel. Native C mods and wasm are removed. The Insert menu is the menu system mod. One squashed commit of the former
mod-api branch (#2434).

Co-authored-by: Chloe Christley <[email protected]>
Co-authored-by: Jer9 <[email protected]>
Co-authored-by: snaildev99 <[email protected]>
Co-authored-by: SqueezyLemonade <[email protected]>
Co-authored-by: flashman4 <[email protected]>
Co-authored-by: dyst <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The release's builder links glslang's C++ runtime in (-l:libc++.a, -l:libc++abi.a on Windows, -l:libstdc++.a on
Linux). The check now looks for them in CARGO_ENCODED_RUSTFLAGS, each flag whole, and asks that no flag is one
character. It fails on mod-api: the flags are added to the list as a string, one character at a time.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(builder): the release's builder links its C++ runtime in again: longshot_builder.py build's flags are whole
All checks were successful
PR description / Title and description (pull_request_target) Successful in 38s
50a0a69717
`flags += " -C link-arg=..."` added a string to the list of rustc's flags one character at a time, so
CARGO_ENCODED_RUSTFLAGS held " ", "-", "C", ... and the release's builder (both systems) did not get its
-l:libc++.a / -l:libstdc++.a. The flags are now list items, as the rest of the function's are.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Measurements: the check's result before (mod-api @ 9e6b9c57, fails) and after (50a0a697, passes), with a Baseline line, as standards.md's Measurements asks of a fix.

Measurements: the check's result before (mod-api @ 9e6b9c57, fails) and after (50a0a697, passes), with a Baseline line, as standards.md's Measurements asks of a fix.
llun force-pushed fix/mod-api-builder-flags from 50a0a69717
All checks were successful
PR description / Title and description (pull_request_target) Successful in 38s
to 77ec30c293
All checks were successful
PR description / Title and description (pull_request_target) Successful in 12s
2026-11-29 22:15:14 +00:00
Compare
Author
Member

Rebased onto mod-api's new squash eaf4a48b (the same tree as 9e6b9c57, which this branch was on): the diff is this PR's own commits again. The checks and runs above hold as they are (the tree under them is unchanged); the description's commits are the new ones.

Rebased onto mod-api's new squash eaf4a48b (the same tree as 9e6b9c57, which this branch was on): the diff is this PR's own commits again. The checks and runs above hold as they are (the tree under them is unchanged); the description's commits are the new ones.
Author
Member

Risks now says how this change stands with the sandbox (what it touches, and why the confined game reaches nothing more).

Risks now says how this change stands with the sandbox (what it touches, and why the confined game reaches nothing more).
llun force-pushed fix/mod-api-builder-flags from 77ec30c293
All checks were successful
PR description / Title and description (pull_request_target) Successful in 12s
to d30e8cdd29
All checks were successful
PR description / Title and description (pull_request_target) Successful in 14s
2026-11-29 23:27:28 +00:00
Compare
Author
Member

Rebased onto mod-api's newest (4cc50ca1: main's newest merged in), with no conflict; this PR's own checks were run again on the rebased head and pass as before. The merge touched none of this PR's files (#2827: only a comment in host/hos_main.c, far from its change), so the measurements and runs above hold; the After commit is the rebased head.

Rebased onto mod-api's newest (4cc50ca1: main's newest merged in), with no conflict; this PR's own checks were run again on the rebased head and pass as before. The merge touched none of this PR's files (#2827: only a comment in host/hos_main.c, far from its change), so the measurements and runs above hold; the After commit is the rebased head.
llun force-pushed fix/mod-api-builder-flags from d30e8cdd29
All checks were successful
PR description / Title and description (pull_request_target) Successful in 14s
to d58044ad26
All checks were successful
PR description / Title and description (pull_request_target) Successful in 14s
2026-11-29 23:58:23 +00:00
Compare
Author
Member

Rebased onto mod-api @ 816d2354 (#2837, headless shots of the mods' UI), now d58044ad. No conflict, and the diff is the same as before (same git patch-id). #2837 touches none of this PR's files.

Rebased onto `mod-api` @ 816d2354 ([#2837](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2837), headless shots of the mods' UI), now d58044ad. No conflict, and the diff is the same as before (same `git patch-id`). #2837 touches none of this PR's files.
llun force-pushed fix/mod-api-builder-flags from d58044ad26
All checks were successful
PR description / Title and description (pull_request_target) Successful in 14s
to daf95b29ef
All checks were successful
PR description / Title and description (pull_request_target) Successful in 15s
2026-11-30 00:38:34 +00:00
Compare
llun force-pushed fix/mod-api-builder-flags from daf95b29ef
All checks were successful
PR description / Title and description (pull_request_target) Successful in 15s
to 3628cf9a97
All checks were successful
PR description / Title and description (pull_request_target) Successful in 22s
2026-11-30 00:42:56 +00:00
Compare
Author
Member

Rebased onto mod-api @ c5e5b676: it was re-squashed onto main @ 46291934 (#2833) twice today (cdbb8551, then c5e5b676), which made this PR show main's and the whole mod API's diff. Now 3628cf9a, the same diff as before (same git patch-id), no conflict. The changes underneath touch none of this PR's files, so its checks still hold.

Rebased onto `mod-api` @ c5e5b676: it was re-squashed onto main @ 46291934 (#2833) twice today (cdbb8551, then c5e5b676), which made this PR show main's and the whole mod API's diff. Now 3628cf9a, the same diff as before (same `git patch-id`), no conflict. The changes underneath touch none of this PR's files, so its checks still hold.
All checks were successful
PR description / Title and description (pull_request_target) Successful in 22s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/mod-api-builder-flags:llun-fix/mod-api-builder-flags'
git switch 'llun-fix/mod-api-builder-flags'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'mod-api'
git merge --no-ff 'llun-fix/mod-api-builder-flags'
git switch 'llun-fix/mod-api-builder-flags'
git rebase 'mod-api'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-builder-flags'
git switch 'llun-fix/mod-api-builder-flags'
git rebase 'mod-api'
git switch 'mod-api'
git merge --no-ff 'llun-fix/mod-api-builder-flags'
git switch 'mod-api'
git merge --squash 'llun-fix/mod-api-builder-flags'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-builder-flags'
git switch 'mod-api'
git merge 'llun-fix/mod-api-builder-flags'
git push origin 'mod-api'
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!2824
No description provided.