Skip to content

make_game.py: build the runtime stage on Linux with clang-cl and xwin - #1229

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kmorales13:build/linux-runtime-stage
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kmorales13:build/linux-runtime-stage

Conversation

@kmorales13

Copy link
Copy Markdown
Contributor

New BUILD item, claimed in #1006 (claim). Follows BUILD-134; --runtime-build is unchanged.

What and why

On Linux, make_game.py's runtime stage refused to run without --runtime-build, even though runtime/cmake/clang-cl-xwin.cmake (docs/testing.md, "The Windows runtime on Linux") already cross-builds the same PE files. Now, off Windows:

  • runtime: cross-builds gta6rt.exe and gta6rt_tls_host.dll into runtime/build/windows with that toolchain. The SDK comes from XWIN_DIR, or ~/.local/share/xwin-sdk as in docs/testing.md. It then packages them with the existing gta6rt.sh Wine launcher.
  • preflight:
    • Lists what the cross-build lacks: cmake, clang-cl/lld-link/llvm-lib/llvm-rc/llvm-mt, clang-cl older than 19, or an xwin splat without VC/Tools/MSVC or Windows Kits/10/Lib/*/um/x64.
    • Then runs the cross-build's CMake configure, so any toolchain error stops the run before the shader stage instead of hours later.
  • Default stages: runtime is kept when the cross-build has everything it needs. Otherwise it is left out with the reason, as before. Asking for it explicitly lists what is missing.
  • pipelines: vk_pipeline_check is built natively into runtime/build/linux (the README's folder) at the end of preflight when it is missing. Preflight then checks that it landed where pipelines() looks.
  • CMake generator and build type: Ninja when it is on PATH, otherwise CMake's default, plus RelWithDebInfo. Both are chosen only for a new build folder, so an existing one keeps its settings.
  • Unchanged on Windows: the build_runtime.ps1 path, the Visual Studio and VULKAN_SDK checks, and their messages.

README.md ("Running the loader on Linux") and docs/testing.md are updated to match. Neighbouring edits that may cause a small rebase conflict: #1140 (module docstring stage list) and #379 (imports, run()).

Tested

CachyOS (kernel 7.3.5), AMD Ryzen 7 7700X iGPU (RDNA2, RADV Mesa 26.3.1), clang 23.1.5, CMake 4.5.1 without Ninja (Unix Makefiles), Wine 11.22, Python 3.14.10. No game files.

  • The make_game test scripts (11 files) pass. The new tests cover:

    • default stages with and without the cross-build;
    • the preflight list and the configure step;
    • the exact configure and build commands;
    • the Ninja fallback, and an existing build folder keeping its generator and build type;
    • the clang version check and the xwin folder checks;
    • the native checker build.

    The tests mock every tool, so none of them runs cmake or a compiler.

  • All 140 stdlib test scripts were run: 139 pass. test_world_index_three_streams.py also fails on main with zlib-ng's compressed sizes; that is unrelated to this change.

  • Real run, nothing mocked:

    • preflight(["runtime", "pipelines"]) built vk_pipeline_check in 4 s.
    • runtime() cross-built and packaged gta6rt.exe (PE32+), gta6rt_tls_host.dll, gta6rt.sh and game_path.txt in 11 s.
    • gta6rt.sh starts the loader under Wine.
    • A broken xwin splat stops in preflight.

The full make_game.py run from check onwards wasn't done, because check needs a game copy.

AI-assisted (Claude-Opus).

Off Windows the runtime stage refused to run without --runtime-build. It now
cross-builds gta6rt.exe and gta6rt_tls_host.dll into runtime/build/windows
with runtime/cmake/clang-cl-xwin.cmake (XWIN_DIR, or ~/.local/share/xwin-sdk
as in docs/testing.md), then packages them with the Wine launcher as before.

Preflight lists what the cross-build lacks (cmake, the LLVM tools, clang-cl
older than 19, an xwin splat without VC/Tools/MSVC or Windows Kits um/x64)
and then configures it, so any toolchain error stops the run before the
shader stage. Without the tools the default stages still leave runtime out;
asking for it lists what is missing. The pipelines stage's vk_pipeline_check
is built natively into runtime/build/linux at the end of preflight, for the
same reason.
@kapitche

kapitche commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Tested 273886d on Linux (WSL2 Ubuntu), Python 3.12, CPU only (the cross-build itself wasn't run; no clang-cl 19 or xwin here): tests pass.

  • The four touched test files: 126 passed, 1 skipped. With main's make_game.py, argparse fails 3, pipeline-preflight fails 6, and platform errors at collection.
  • Merging build_llvm_mc: install llvm-mc outside AppData, where the install manager's python can see it #1233 is clean, with 130 passed.
  • Windows paths are unchanged in the diff:
    • the VC++ check is now guarded by os.name == "nt";
    • the pipelines check keeps runtime_building and VULKAN_SDK;
    • cross_configure and build_pipeline_check only run off Windows;
    • run()'s new hint defaults to the old text.
  • One behaviour note: on Linux, preflight now runs a CMake configure (and builds vk_pipeline_check for the pipelines stage), so it's no longer side-effect free there. That's stated in the PR. --check still returns before preflight, so it isn't affected.

@whattheflop whattheflop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted independent review of 273886db50b93d7ac0da68b0dfd1fe41d1a80f7d against its direct parent 0d61c357656d92334eef97facec1ae4f7b2b60b1.

One compatibility gap in make_game.py:382: docs/testing.md documents setting CMake's LLVM tool paths when a distro exposes versioned names. The new preflight checks only the unsuffixed names on PATH, even for an existing runtime/build/windows configured with those CMake overrides. With the stock preflight double exposing CMake, a valid SDK layout, and only the LLVM 21-suffixed names, all five tools are reported missing. Default stage selection then drops runtime, while explicit runtime fails preflight. Could the automatic path honor the cached tool paths, or could the docs make the unsuffixed PATH requirement and manual build with --runtime-build explicit?

  • Native Windows with uv-managed CPython 3.12.13: all 11 focused test_make_game_*.py scripts finished successfully at head, and normal --help succeeded on both commits. The stock doubles recorded identical PowerShell build and vswhere commands, supplied-build routing, and Visual Studio/Vulkan SDK preflight outcomes on both commits. Build commands were mocked.
  • Existing Ubuntu WSL with system Python 3.14.4: normal --help and direct, unmocked preflight checks ran without installing anything. At head, runtime preflight listed the missing CMake, LLVM tools, and xwin SDK. Pipelines preflight reported the missing CMake prerequisite for building the checker. Both stopped before creating a work directory. Full build CLI execution requires the game check first. These checks used no game files, loader execution, or GPU.

@ItsNotRexed
ItsNotRexed merged commit 4d94045 into ItsNotRexed:main Nov 22, 2026
11 checks passed
@kmorales13

Copy link
Copy Markdown
Contributor Author

Thanks @whattheflop, good catch. This missed the merge, so it is in #1273:

  • Versioned names: preflight now accepts the newest full set with one version suffix (clang-cl-21, lld-link-21, llvm-lib-21, llvm-rc-21, llvm-mt-21) when the plain names aren't on PATH. It passes them to a new runtime/build/windows as the toolchain's CMAKE_<var> overrides, the same ones docs/testing.md describes. Mixed versions don't count.
  • Existing build folder: a runtime/build/windows whose cached CMAKE_CXX_COMPILER still exists needs no LLVM tools on PATH, and keeps what it was configured with.
  • Docs: the README names both forms. The missing-tools message says the same.

Tested with only clang-cl-23/lld-link-23/llvm-lib-23/llvm-rc-23/llvm-mt-23, cmake and make on PATH: preflight passed, the configure got all six overrides, and the build produced gta6rt.exe and gta6rt_tls_host.dll. With the cache in place and no LLVM tools on PATH, preflight passed too. New unit tests cover the suffix pick, mixed versions, the cached compiler and the overrides going only to a new folder.

Thanks @kapitche for the WSL run.

AI-assisted (Claude-Opus).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants