build_runtime: link user32 into vk_sandbox in the cl.exe fallback (BUILD-FALLBACK-SANDBOX-USER32) #1484

Open
github-bot wants to merge 3 commits from github-bot/gh-1484 into main AGit
Owner

@⁠kawaii-shakal on GitHub · 2026-11-25 01:24 UTC · original
kawaii-shakal:build-fallback-sandbox-user32 → main · +18 −1 · 2 files · 3 commits · open

Claim: #14 (BUILD-FALLBACK-SANDBOX-USER32)

What and why

scripts/build_runtime.ps1 has a fallback for machines without CMake and Ninja: it builds each program with its own cl line. CMake's Visual Studio and Ninja generators link the standard Windows libraries into every program (CMAKE_CXX_STANDARD_LIBRARIES: kernel32, user32, gdi32, ...). A plain cl line links none of them.

vk_sandbox opens a window, so its fallback link failed with 14 unresolved __imp_* symbols (CreateWindowExW, PeekMessageW, RegisterClassW, GetAsyncKeyState, ...). build_runtime.ps1 then exited 1, and so did make_game.py --stages ...,runtime, which calls it.

  • scripts/build_runtime.ps1: /link user32.lib on the vk_sandbox line.
  • tests/test_build_runtime_fallback.py: new test_a_program_that_opens_a_window_links_user32. It checks every fallback cl line whose test source calls the window API and requires user32.lib on it. Without the fix it fails on vk_sandbox.cpp.

Tested

  • python -I tests/test_build_runtime_fallback.py: 11 of 11 pass. The new test fails without the script change.
  • I ran the fallback for real through make_game.py --stages check,shaders,runtime, on a machine with VS 2026 and the Vulkan SDK but no Ninja. That run used a checkout of a28927849 with the same one-line change, because that is the commit my translated shaders came from; the vk_sandbox line is identical on current main. Before the change it failed with the LNK2019 / LNK1120 above. After it, every fallback program built, including vk_sandbox.exe, and the stage finished in 46 s.
  • Environment: Windows 11 Pro 26300, MSVC 19.50, Vulkan SDK from VULKAN_SDK, native (no WSL).

AI-assisted: yes (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

**@⁠kawaii-shakal** on GitHub · 2026-11-25 01:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1484) `kawaii-shakal:build-fallback-sandbox-user32` → `main` · +18 −1 · 2 files · 3 commits · open Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 (BUILD-FALLBACK-SANDBOX-USER32) ### What and why `scripts/build_runtime.ps1` has a fallback for machines without CMake and Ninja: it builds each program with its own `cl` line. CMake's Visual Studio and Ninja generators link the standard Windows libraries into every program (`CMAKE_CXX_STANDARD_LIBRARIES`: kernel32, user32, gdi32, ...). A plain `cl` line links none of them. `vk_sandbox` opens a window, so its fallback link failed with 14 unresolved `__imp_*` symbols (`CreateWindowExW`, `PeekMessageW`, `RegisterClassW`, `GetAsyncKeyState`, ...). `build_runtime.ps1` then exited 1, and so did `make_game.py --stages ...,runtime`, which calls it. - `scripts/build_runtime.ps1`: `/link user32.lib` on the `vk_sandbox` line. - `tests/test_build_runtime_fallback.py`: new `test_a_program_that_opens_a_window_links_user32`. It checks every fallback `cl` line whose test source calls the window API and requires `user32.lib` on it. Without the fix it fails on `vk_sandbox.cpp`. ### Tested - `python -I tests/test_build_runtime_fallback.py`: 11 of 11 pass. The new test fails without the script change. - I ran the fallback for real through `make_game.py --stages check,shaders,runtime`, on a machine with VS 2026 and the Vulkan SDK but no Ninja. That run used a checkout of `a28927849` with the same one-line change, because that is the commit my translated shaders came from; the `vk_sandbox` line is identical on current main. Before the change it failed with the LNK2019 / LNK1120 above. After it, every fallback program built, including `vk_sandbox.exe`, and the stage finished in 46 s. - Environment: Windows 11 Pro 26300, MSVC 19.50, Vulkan SDK from `VULKAN_SDK`, native (no WSL). AI-assisted: yes (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CMake's Visual Studio and Ninja builds link kernel32, user32, gdi32 and the other
standard libraries into every program. A plain cl line links none of them.
vk_sandbox opens a window, so the fallback's link stopped at 14 unresolved
__imp_ symbols (CreateWindowExW, PeekMessageW, ...), and build_runtime.ps1
exited 1 on any machine without CMake and Ninja.

The new test fails any fallback cl line whose test source calls the window
API without /link user32.lib.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:53:38 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-25 09:01 UTC · original

Independent reproduction and test of this fix, on a second machine.

Hardware and toolchain: Windows 11 Pro 26300, VS 2022 17.14.29 (MSVC 14.44.35207), Vulkan SDK 1.4.363.0 in VULKAN_SDK, AMD Radeon RX 7900 XT. CMake was on PATH but Ninja was not, so build_runtime.ps1 took the cl.exe fallback.

How I hit it: make_game.py --stages check,shaders,runtime on 4a50cafc7 stopped in the runtime stage. The cause was vk_sandbox.exe : fatal error LNK1120: 14 unresolved externals, and the unresolved symbols were the __imp_* window functions this PR describes (TranslateMessage, PeekMessageW, CreateWindowExW, ...). The command that failed was powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 -Jobs 8.

What I tested: I applied this PR's two-file diff (scripts/build_runtime.ps1, tests/test_build_runtime_fallback.py) to 4a50cafc7. The vk_sandbox line there is identical to the one on main. I then ran the fallback on both trees, with Ninja removed from PATH:

without the PR with the PR
build_runtime.ps1 (cl.exe fallback) exit 1, LNK1120: 14 unresolved externals on vk_sandbox.exe exit 0, all 17 programs built, including vk_sandbox.exe and vk_ps_sweep.exe
python -I tests/test_build_runtime_fallback.py 10/10 pass; the new test, run against the old script, fails on vk_sandbox.cpp 11/11 pass

The one-line change fixes the fallback on MSVC 14.44 as well. The new test catches the old script.

**@⁠adrianmjim** on GitHub · 2026-11-25 09:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1484#issuecomment-7157779985) Independent reproduction and test of this fix, on a second machine. **Hardware and toolchain:** Windows 11 Pro 26300, VS 2022 17.14.29 (MSVC 14.44.35207), Vulkan SDK 1.4.363.0 in `VULKAN_SDK`, AMD Radeon RX 7900 XT. CMake was on PATH but Ninja was not, so `build_runtime.ps1` took the `cl.exe` fallback. **How I hit it:** `make_game.py --stages check,shaders,runtime` on `4a50cafc7` stopped in the runtime stage. The cause was `vk_sandbox.exe : fatal error LNK1120: 14 unresolved externals`, and the unresolved symbols were the `__imp_*` window functions this PR describes (`TranslateMessage`, `PeekMessageW`, `CreateWindowExW`, ...). The command that failed was `powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 -Jobs 8`. **What I tested:** I applied this PR's two-file diff (`scripts/build_runtime.ps1`, `tests/test_build_runtime_fallback.py`) to `4a50cafc7`. The `vk_sandbox` line there is identical to the one on main. I then ran the fallback on both trees, with Ninja removed from PATH: | | without the PR | with the PR | |---|---|---| | `build_runtime.ps1` (cl.exe fallback) | exit 1, `LNK1120: 14 unresolved externals` on `vk_sandbox.exe` | exit 0, all 17 programs built, including `vk_sandbox.exe` and `vk_ps_sweep.exe` | | `python -I tests/test_build_runtime_fallback.py` | 10/10 pass; the new test, run against the old script, fails on `vk_sandbox.cpp` | 11/11 pass | The one-line change fixes the fallback on MSVC 14.44 as well. The new test catches the old script.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1484/head:github-bot/gh-1484'
git switch 'github-bot/gh-1484'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1484'
git switch 'github-bot/gh-1484'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1484'
git switch 'github-bot/gh-1484'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1484'
git switch 'main'
git merge --squash 'github-bot/gh-1484'
git switch 'main'
git merge --ff-only 'github-bot/gh-1484'
git switch 'main'
git merge 'github-bot/gh-1484'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.