[PR #227] [MERGED] Linux: versioned llvm-mc, Build.sh/Mods.sh, case diagnostic, portable runtime tests, docs/linux.md #279

Closed
opened 2026-11-26 20:17:21 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/227
Author: @bhimio1
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: feat/linux-native-support


📝 Commits (5)

  • fca3be7 fix(linux): find a versioned llvm-mc and give Linux install hints
  • 5a8af54 build(linux): add Build.sh and Mods.sh, the shell counterparts of Build.bat and Mods.bat
  • b556acb fix(linux): name a version probe file whose name differs only in case
  • 6fbb25e build(linux): build the portable root-signature and host CPU tests on every OS
  • 8e9708f docs(linux): a Linux page: what runs natively, the packages, Build.sh, the runtime under Wine

📊 Changes

16 files changed (+514 additions, -62 deletions)

View changed files

➕ Build.sh (+16 -0)
➕ Mods.sh (+13 -0)
📝 README.md (+5 -3)
📝 docs/README.md (+2 -1)
➕ docs/linux.md (+114 -0)
📝 docs/modding.md (+2 -1)
📝 docs/testing.md (+3 -1)
📝 make_game.py (+28 -8)
📝 runtime/CMakeLists.txt (+25 -26)
📝 runtime/test/host_cpu_test.cpp (+17 -2)
📝 tests/test_make_game_preflight.py (+22 -0)
📝 tests/test_mc_command.py (+85 -2)
➕ tests/test_shell_launchers.py (+114 -0)
📝 tools/leonida_mods.py (+4 -3)
📝 tools/mc_command.py (+58 -6)
📝 tools/shader_disasm.py (+6 -9)

📄 Description

Linux support, as far as it can go in one reviewable change. The repository already did a lot on Linux: the translator and asset tools ran natively, a native CMake build covered the Vulkan tools, and the runtime was cross-built with clang-cl + xwin and run under Wine. This PR fixes what still stopped a native Linux user, grows the portable runtime subset, adds Linux CI, and puts the Linux story on one page.

No game data, keys or online services are involved; scripts/check_no_game_data.py was run on every file added or changed. No one else is doing Linux work in this repository's open issues or pull requests (checked before starting; #19 also edits make_game.py, in an unrelated part).

What changed and why

  1. fix(linux): llvm-mc on Debian/Ubuntu (tools/mc_command.py, tools/shader_disasm.py, make_game.py). apt install llvm-21 installs llvm-mc-21 and /usr/lib/llvm-21/bin/llvm-mc, never a plain llvm-mc, so the shaders stage stopped with Windows-only advice (scripts\build_llvm_mc.ps1, WSL). tests/conftest.py already found the versioned install, so the pytest suites passed where make_game.py failed. With LLVM_MC unset, mc_command() still uses the plain name when it is on PATH (so existing work folders' recorded disassembly command doesn't change), and otherwise takes the newest versioned install, compared by number. The missing-tool messages are now per OS (install_hint()), and the SPIRV-Tools hint names the distribution package on Linux. Editing shader_disasm.py changes the FSPX/BVH-builder digests, so those two small sets (29 + 52 shaders) are translated again once; the 26,503-shader corpus is unaffected (TRANSLATION_SOURCES doesn't include it).
  2. build(linux): Build.sh and Mods.sh, the counterparts of Build.bat and Mods.bat: they find Python 3.12+ (versioned python3.N first) and run make_game.py / the mod manager window with -I and every argument passed through. They install and download nothing. The mod manager's missing-Tkinter message now names python3-tk off Windows.
  3. fix(linux): case-sensitive file names. A package copy whose names changed case (microsoftgame.config) was reported only as "Missing MicrosoftGame.Config". The version probe now names the variant it found and why that doesn't count. Nothing is renamed or case-folded.
  4. build(linux): portable runtime tests. src/root_signature.h says it "compiles on Linux CI" and src/host_cpu.cpp already had its POSIX branches, but root_signature_test and host_cpu_test were inside the Windows-only CMake block. They now build on every OS (MSVC keeps its flags); host_cpu_test uses setenv/unsetenv off Windows.
  5. docs(linux): docs/linux.md: what runs natively and what runs under Wine, the Ubuntu 26.04 package for each stage (no .NET 8 SDK is packaged there; dotnet-sdk-10.0 builds rpf9dump through global.json's roll-forward, verified below), ./Build.sh, the cross-build, and why there is no native Linux gta6rt (below). Linked from README and docs/README.md.
  6. ci(linux): not in this branch yet, see "CI commit" below.

Why the runtime stays a Windows program (documented limitation)

A native ELF gta6rt is not a portability-flag change. The loader shims only the console's modules and the Win32 entry points it must own; every other import binds to the host's Windows DLLs (runtime/src/pe_loader.cpp; docs/runtime_imports.md: XboxBvhBuilder.dll alone binds 4 imports to shims and 53 to the host). The mapped code also uses the Windows x64 ABI and exception/TLS model (RtlAddFunctionTable, gta6rt_tls_host.dll, a vectored exception handler in main.cpp), and the shims are written against windows.h. A Linux-native host would have to reimplement those Win32 APIs, which is what Wine does. So the supported Linux route remains the Windows build under Wine/Proton with the D3D12 layer on native Vulkan, and this PR grows only the parts that need no Win32.

What works on Linux now, and how it was verified

All on Ubuntu 26.04.1 LTS, x86-64, no GPU (Vulkan tests ran on Mesa lavapipe: device: llvmpipe (LLVM 21.1.8, 256 bits)), Python 3.14, CMake 4.2.3, Ninja.

  • Native runtime subset builds with GCC 15.2: 154/154 targets, 0 warnings; ctest 70/70 passed (2 skipped: shader_library_corpus needs game data, vk_sync_validation needs the validation layer). After the CMake change, the two moved tests also build and pass under GCC.
  • Native runtime subset builds with Clang 21.1 at this branch's head: 0 warnings; ctest 72/72 passed (same 2 skips).
  • root_signature_test (56/56 checks) and host_cpu_test pass under GCC and Clang.
  • Versioned llvm-mc found with no LLVM_MC: mc_command() → ['/usr/bin/llvm-mc-21'] here; new VersionedLlvmMcTest cases (fake install layouts, numeric version order, llvm-mca not mistaken for llvm-mc, plain name kept, LLVM_MC wins). tests/test_mc_command.py, test_shader_disasm.py, test_make_game_preflight.py, test_make_game_platform.py pass.
  • ./Build.sh --help and ./Mods.sh --help run through the system Python; tests/test_shell_launchers.py (stub interpreters on a private PATH: picks the first 3.12+, passes awkward arguments through unchanged, exit code comes back, message when none) passes; shellcheck -s sh is clean.
  • Case diagnostic: new tests in tests/test_make_game_preflight.py.
  • rpf9dump on Linux with Ubuntu's .NET 10 SDK (10.0.115): dotnet build tools/rpf9dump/rpf9dump.csproj -c Release succeeds (0 warnings); tests/test_ttpf_export_resume.py passes; tests/Rpf9DumpDiagnostics passes.
  • Docs tests (tests/test_docs_*.py, test_i18n_index.py) pass, as does tests/test_ci_registration.py.
  • No regressions in the full Python suites, compared with unmodified main (9ec34cd) on this machine, with CI's LLVM_MC=/usr/lib/llvm-21/bin/llvm-mc and LEONIDA_REQUIRE_SPIRV_TOOLS=1:
    • semantic suite (scripts/run_semantic_tests.py): 463 files, 6,075 tests on both; the same 2 files fail on both (test_exec_computed, test_image_atomics_guard).
    • standard-library loop: branch 459/464 files pass, base 458/463; the same 5 files fail on both (test_f64_conversion, test_f64_output_modifiers, test_joaat_agreement, test_make_game_argparse, test_rdna2_decode); the one new file, test_shell_launchers.py, passes.
    • pytest files (the translator-tests selection): 1,863 passed, 14 skipped, 1 failed on both; the same pre-existing failure (test_user_sgpr_census.py::test_json_report_refuses_to_overwrite_index[folding-volume-case]).

Not done / untested

  • The CI commit isn't pushed (see below): the new jobs haven't run on GitHub. Their run blocks pass shellcheck and the YAML parses; each job mirrors a command run locally above.
  • Untested: needs the game files: make_game.py's shaders/assets/pipelines stages on a real package on Linux, the case diagnostic against a real copy, and anything gta6rt does with the retail executable.
  • Untested: needs a GPU: everything here ran on lavapipe only. scripts/run_gpu_tests.py was not run on this branch (the existing linux-gpu-tools job covers it on llvmpipe; this PR doesn't change the translator).
  • Untested here: the clang-cl + xwin cross-build and the Wine runs. They need xwin's download of Microsoft's CRT and SDK, which means accepting Microsoft's licence; I didn't accept it on the project's behalf. make_game.py does find the versioned cross tools on Ubuntu 26.04 (cross_tool_suffix() == '-21'; clang-cl-21 comes from clang-21 there, clang-tools-<N> on 24.04), and lists only the missing xwin SDK. A CI job for the cross-build is a maintainer decision for the same licence reason.
  • No native ELF gta6rt: documented limitation above, not attempted.
  • PowerShell research helpers have no shell equivalent: scripts/carve_all.ps1, first_look.ps1, meta_to_xml.ps1 (CodeWalker, Windows), run_conservative_tier3_reference.ps1 (Windows D3D12 reference). None is needed by the build; carve_all.ps1 would be the one worth porting.
  • Pre-existing, not Linux-specific (finding): tests/test_rpf9dump_exit_codes.py's two blocked-write cases put a directory at <file>.partial, but Util.WriteAtomic writes to a unique <file>.<pid>.<tid>.<guid>.partial, so nothing is blocked: they fail on Linux, and by the code they would on Windows too (the Windows step has been skipped in every recent run, because an earlier step fails). I left the test alone and kept it out of the new Linux job; the check job still runs it.
  • Pre-existing failures on main (fail identically with and without this PR, listed above). test_make_game_argparse.py is the --jobs 10 case PR #1 addresses.
  • i18n quickstarts are not updated (English only).

CI commit (local, not pushed)

The token I pushed with has no workflow scope, and GitHub refuses any push that touches .github/workflows/. So the last commit, ci(linux): build the runtime with Clang, build rpf9dump on Linux, run Build.sh, is ready but not on this branch. It adds:

  • runtime.yml → linux-clang: native Linux build + full ctest with Clang (linux-gpu-tools uses GCC only), with a check that CMake really picked Clang.
  • ci.yml → rpf9dump-linux: builds rpf9dump on Linux (the check job builds it on Windows only) and runs test_ttpf_export_resume.py and the diagnostics project.
  • ci.yml → stdlib-tests-linux: ./Build.sh --help.
  • docs/linux.md: the "how it is checked" column then names those jobs.

Actions are pinned to the same commits as the existing jobs. The diff is below; I'll push it as soon as the push credentials have workflow scope.

Workflow diff
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8aa6133..cd39927 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -269,6 +269,38 @@ jobs:
       - name: Viewer chunk streaming (synthetic, no browser or game data)
         run: node --test tests/test_*.cjs
 
+  # rpf9dump, the asset exporter, built and run on Linux: the check job builds it on Windows only, while the assets
+  # stage of make_game.py builds the same project on Linux (on Ubuntu 26.04 its .NET 10 SDK does it through
+  # global.json's latestMajor roll-forward). Every input is synthetic. tests/test_rpf9dump_exit_codes.py is not run
+  # here: its two blocked-write cases put a directory at <file>.partial, which Util.WriteAtomic no longer writes (it
+  # uses a unique <file>.<pid>.<tid>.<guid>.partial), so they fail on Linux; the check job still runs the file.
+  rpf9dump-linux:
+    needs: change-scope
+    if: ${{ !cancelled() && needs.change-scope.outputs.docs-only != 'true' }}
+    runs-on: ubuntu-24.04
+    timeout-minutes: 15
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          submodules: recursive
+          persist-credentials: false
+      - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
+        with:
+          python-version: "3.12"
+      - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
+        with:
+          dotnet-version: "8.0.x"
+          cache: true
+          cache-dependency-path: "**/packages.lock.json"
+      - name: Build rpf9dump
+        run: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release
+      - name: Test TTPF export retry
+        env:
+          RPF9DUMP_DLL: tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll
+        run: python -I tests/test_ttpf_export_resume.py
+      - name: Test rpf9dump diagnostics
+        run: dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release
+
   # The check job runs the standard-library loop on Windows, which has no SPIRV-Tools or numpy: the spirv-val checks
   # (test_split_big_switch, test_image_load_typed...), the numpy paths and the POSIX-only tests skip there. This job
   # runs the same loop on Linux with them installed, so those tests run somewhere.
@@ -290,6 +322,9 @@ jobs:
           sudo apt-get update
           sudo apt-get install -y --no-install-recommends spirv-tools
           pip install -r tests/requirements.txt
+      # The Linux entry point, as the check job runs make_game.py --help on Windows.
+      - name: Build.sh help
+        run: ./Build.sh --help
       - name: Tests (standard library only, Linux)
         shell: bash
         run: |
diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml
index cafdf46..8b4af9f 100644
--- a/.github/workflows/runtime.yml
+++ b/.github/workflows/runtime.yml
@@ -496,6 +496,59 @@ jobs:
             fi
           done <<< "$names"
 
+  # The same native Linux build with Clang instead of the runner's default GCC, so a change that only one of the two
+  # compilers accepts shows up on a pull request. The CPU and llvmpipe runtime tests run; the GPU shader tests are
+  # left to linux-gpu-tools, which already runs them on llvmpipe.
+  linux-clang:
+    runs-on: ubuntu-24.04
+    timeout-minutes: 20
+    env:
+      SCCACHE_GHA_ENABLED: "true"
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
+      - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
+      - name: Cache Vulkan headers
+        id: vulkan-headers-cache
+        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+        with:
+          path: .vulkan-headers/include
+          key: vulkan-headers-6802bb4733b63ed5efd3adb308a6c885ef180ea1
+      - name: Checkout Vulkan headers (vulkan-sdk-1.4.363.0)
+        if: steps.vulkan-headers-cache.outputs.cache-hit != 'true'
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          repository: KhronosGroup/Vulkan-Headers
+          ref: 6802bb4733b63ed5efd3adb308a6c885ef180ea1 # vulkan-sdk-1.4.363.0
+          path: .vulkan-headers
+          sparse-checkout: include
+          persist-credentials: false
+      - name: Install Clang, the Vulkan loader and llvmpipe
+        run: |
+          pkgs=(clang libvulkan-dev mesa-vulkan-drivers)
+          command -v cmake >/dev/null || pkgs+=(cmake)
+          command -v ninja >/dev/null || pkgs+=(ninja-build)
+          sudo apt-get update
+          sudo apt-get install -y --no-install-recommends "${pkgs[@]}"
+          clang++ --version
+      - name: Configure
+        env:
+          CC: clang
+          CXX: clang++
+          VULKAN_SDK: ${{ github.workspace }}/.vulkan-headers
+        run: >-
+          cmake -S runtime -B runtime/build -G Ninja
+          -DCMAKE_BUILD_TYPE=RelWithDebInfo
+          -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
+          -DLEONIDA_REQUIRE_VULKAN=ON
+      - name: Check the compiler is Clang
+        run: grep -h 'set(CMAKE_CXX_COMPILER_ID "Clang")' runtime/build/CMakeFiles/*/CMakeCXXCompiler.cmake
+      - name: Build
+        run: cmake --build runtime/build --parallel
+      - name: Runtime tests (Linux, Clang)
+        run: ctest --test-dir runtime/build --output-on-failure -j "$(nproc)"
+
   # Builds the runtime on an Apple Silicon Mac and runs its tests and the hand-written GPU tests on MoltenVK. The
   # hosted runner is a VM whose Metal device is "Apple Paravirtual device" (MTLGPUFamilyMac2, not Apple7), so
   # Mesa's KosmicKrisp finds no device there; MoltenVK runs, with 32-wide subgroups. macos-26, not macos-15: Xcode

Try it on Linux

sudo apt install git python3 llvm-21 spirv-tools dotnet-sdk-10.0 cmake ninja-build g++ libvulkan-dev
git clone --recursive -b feat/linux-native-support https://github.com/bhimio1/leonida && cd leonida
./Build.sh --help
python3 -I -c "import sys; sys.path.insert(0, 'tools'); import mc_command; print(mc_command.mc_command())"
CC=clang CXX=clang++ cmake -S runtime -B runtime/build/linux -G Ninja && cmake --build runtime/build/linux --parallel
ctest --test-dir runtime/build/linux --output-on-failure
./Build.sh --check --game /path/to/your/package     # with your own copy

Written with AI assistance (Claude Code). Tested on Ubuntu 26.04 x86-64 with no GPU: Mesa lavapipe (llvmpipe, LLVM 21.1.8), GCC 15.2, Clang 21.1, .NET SDK 10.0.115.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/227 **Author:** [@bhimio1](https://github.com/bhimio1) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `feat/linux-native-support` --- ### 📝 Commits (5) - [`fca3be7`](https://github.com/ubiquitarianism/leonida/commit/fca3be703c20767ea3e9f837eaab17ef6199f8e0) fix(linux): find a versioned llvm-mc and give Linux install hints - [`5a8af54`](https://github.com/ubiquitarianism/leonida/commit/5a8af54cbdd291ec5767c256d2b8b0242e207bc5) build(linux): add Build.sh and Mods.sh, the shell counterparts of Build.bat and Mods.bat - [`b556acb`](https://github.com/ubiquitarianism/leonida/commit/b556acb19ac43844552a822c816e28d873df424b) fix(linux): name a version probe file whose name differs only in case - [`6fbb25e`](https://github.com/ubiquitarianism/leonida/commit/6fbb25e4de7e895205e8ba240c5af6e57305846a) build(linux): build the portable root-signature and host CPU tests on every OS - [`8e9708f`](https://github.com/ubiquitarianism/leonida/commit/8e9708fd5fc8dada98efeb76ccdc9f78e03b94e3) docs(linux): a Linux page: what runs natively, the packages, Build.sh, the runtime under Wine ### 📊 Changes **16 files changed** (+514 additions, -62 deletions) <details> <summary>View changed files</summary> ➕ `Build.sh` (+16 -0) ➕ `Mods.sh` (+13 -0) 📝 `README.md` (+5 -3) 📝 `docs/README.md` (+2 -1) ➕ `docs/linux.md` (+114 -0) 📝 `docs/modding.md` (+2 -1) 📝 `docs/testing.md` (+3 -1) 📝 `make_game.py` (+28 -8) 📝 `runtime/CMakeLists.txt` (+25 -26) 📝 `runtime/test/host_cpu_test.cpp` (+17 -2) 📝 `tests/test_make_game_preflight.py` (+22 -0) 📝 `tests/test_mc_command.py` (+85 -2) ➕ `tests/test_shell_launchers.py` (+114 -0) 📝 `tools/leonida_mods.py` (+4 -3) 📝 `tools/mc_command.py` (+58 -6) 📝 `tools/shader_disasm.py` (+6 -9) </details> ### 📄 Description Linux support, as far as it can go in one reviewable change. The repository already did a lot on Linux: the translator and asset tools ran natively, a native CMake build covered the Vulkan tools, and the runtime was cross-built with clang-cl + xwin and run under Wine. This PR fixes what still stopped a native Linux user, grows the portable runtime subset, adds Linux CI, and puts the Linux story on one page. No game data, keys or online services are involved; `scripts/check_no_game_data.py` was run on every file added or changed. No one else is doing Linux work in this repository's open issues or pull requests (checked before starting; #19 also edits `make_game.py`, in an unrelated part). ## What changed and why 1. **`fix(linux)`: llvm-mc on Debian/Ubuntu** (`tools/mc_command.py`, `tools/shader_disasm.py`, `make_game.py`). `apt install llvm-21` installs `llvm-mc-21` and `/usr/lib/llvm-21/bin/llvm-mc`, never a plain `llvm-mc`, so the shaders stage stopped with Windows-only advice (`scripts\build_llvm_mc.ps1`, WSL). `tests/conftest.py` already found the versioned install, so the pytest suites passed where `make_game.py` failed. With `LLVM_MC` unset, `mc_command()` still uses the plain name when it is on `PATH` (so existing work folders' recorded disassembly command doesn't change), and otherwise takes the newest versioned install, compared by number. The missing-tool messages are now per OS (`install_hint()`), and the SPIRV-Tools hint names the distribution package on Linux. Editing `shader_disasm.py` changes the FSPX/BVH-builder digests, so those two small sets (29 + 52 shaders) are translated again once; the 26,503-shader corpus is unaffected (`TRANSLATION_SOURCES` doesn't include it). 2. **`build(linux)`: `Build.sh` and `Mods.sh`**, the counterparts of `Build.bat` and `Mods.bat`: they find Python 3.12+ (versioned `python3.N` first) and run `make_game.py` / the mod manager window with `-I` and every argument passed through. They install and download nothing. The mod manager's missing-Tkinter message now names `python3-tk` off Windows. 3. **`fix(linux)`: case-sensitive file names.** A package copy whose names changed case (`microsoftgame.config`) was reported only as "Missing MicrosoftGame.Config". The version probe now names the variant it found and why that doesn't count. Nothing is renamed or case-folded. 4. **`build(linux)`: portable runtime tests.** `src/root_signature.h` says it "compiles on Linux CI" and `src/host_cpu.cpp` already had its POSIX branches, but `root_signature_test` and `host_cpu_test` were inside the Windows-only CMake block. They now build on every OS (MSVC keeps its flags); `host_cpu_test` uses `setenv`/`unsetenv` off Windows. 5. **`docs(linux)`: `docs/linux.md`**: what runs natively and what runs under Wine, the Ubuntu 26.04 package for each stage (no .NET 8 SDK is packaged there; `dotnet-sdk-10.0` builds rpf9dump through `global.json`'s roll-forward, verified below), `./Build.sh`, the cross-build, and why there is no native Linux `gta6rt` (below). Linked from README and `docs/README.md`. 6. **`ci(linux)`: not in this branch yet, see "CI commit" below.** ## Why the runtime stays a Windows program (documented limitation) A native ELF `gta6rt` is not a portability-flag change. The loader shims only the console's modules and the Win32 entry points it must own; every other import binds to the host's Windows DLLs (`runtime/src/pe_loader.cpp`; `docs/runtime_imports.md`: `XboxBvhBuilder.dll` alone binds 4 imports to shims and 53 to the host). The mapped code also uses the Windows x64 ABI and exception/TLS model (`RtlAddFunctionTable`, `gta6rt_tls_host.dll`, a vectored exception handler in `main.cpp`), and the shims are written against `windows.h`. A Linux-native host would have to reimplement those Win32 APIs, which is what Wine does. So the supported Linux route remains the Windows build under Wine/Proton with the D3D12 layer on native Vulkan, and this PR grows only the parts that need no Win32. ## What works on Linux now, and how it was verified All on Ubuntu 26.04.1 LTS, x86-64, **no GPU** (Vulkan tests ran on Mesa lavapipe: `device: llvmpipe (LLVM 21.1.8, 256 bits)`), Python 3.14, CMake 4.2.3, Ninja. - [x] Native runtime subset builds with **GCC 15.2**: 154/154 targets, 0 warnings; `ctest` 70/70 passed (2 skipped: `shader_library_corpus` needs game data, `vk_sync_validation` needs the validation layer). After the CMake change, the two moved tests also build and pass under GCC. - [x] Native runtime subset builds with **Clang 21.1** at this branch's head: 0 warnings; `ctest` **72/72 passed** (same 2 skips). - [x] `root_signature_test` (56/56 checks) and `host_cpu_test` pass under GCC and Clang. - [x] Versioned llvm-mc found with no `LLVM_MC`: `mc_command()` → `['/usr/bin/llvm-mc-21']` here; new `VersionedLlvmMcTest` cases (fake install layouts, numeric version order, `llvm-mca` not mistaken for llvm-mc, plain name kept, `LLVM_MC` wins). `tests/test_mc_command.py`, `test_shader_disasm.py`, `test_make_game_preflight.py`, `test_make_game_platform.py` pass. - [x] `./Build.sh --help` and `./Mods.sh --help` run through the system Python; `tests/test_shell_launchers.py` (stub interpreters on a private `PATH`: picks the first 3.12+, passes awkward arguments through unchanged, exit code comes back, message when none) passes; `shellcheck -s sh` is clean. - [x] Case diagnostic: new tests in `tests/test_make_game_preflight.py`. - [x] **rpf9dump on Linux with Ubuntu's .NET 10 SDK** (10.0.115): `dotnet build tools/rpf9dump/rpf9dump.csproj -c Release` succeeds (0 warnings); `tests/test_ttpf_export_resume.py` passes; `tests/Rpf9DumpDiagnostics` passes. - [x] Docs tests (`tests/test_docs_*.py`, `test_i18n_index.py`) pass, as does `tests/test_ci_registration.py`. - [x] **No regressions in the full Python suites**, compared with unmodified `main` (`9ec34cd`) on this machine, with CI's `LLVM_MC=/usr/lib/llvm-21/bin/llvm-mc` and `LEONIDA_REQUIRE_SPIRV_TOOLS=1`: - semantic suite (`scripts/run_semantic_tests.py`): 463 files, 6,075 tests on both; the same 2 files fail on both (`test_exec_computed`, `test_image_atomics_guard`). - standard-library loop: branch 459/464 files pass, base 458/463; the same 5 files fail on both (`test_f64_conversion`, `test_f64_output_modifiers`, `test_joaat_agreement`, `test_make_game_argparse`, `test_rdna2_decode`); the one new file, `test_shell_launchers.py`, passes. - pytest files (the translator-tests selection): 1,863 passed, 14 skipped, 1 failed on both; the same pre-existing failure (`test_user_sgpr_census.py::test_json_report_refuses_to_overwrite_index[folding-volume-case]`). ## Not done / untested - **The CI commit isn't pushed** (see below): the new jobs haven't run on GitHub. Their run blocks pass `shellcheck` and the YAML parses; each job mirrors a command run locally above. - **Untested: needs the game files**: `make_game.py`'s shaders/assets/pipelines stages on a real package on Linux, the case diagnostic against a real copy, and anything `gta6rt` does with the retail executable. - **Untested: needs a GPU**: everything here ran on lavapipe only. `scripts/run_gpu_tests.py` was not run on this branch (the existing `linux-gpu-tools` job covers it on llvmpipe; this PR doesn't change the translator). - **Untested here: the clang-cl + xwin cross-build and the Wine runs.** They need xwin's download of Microsoft's CRT and SDK, which means accepting Microsoft's licence; I didn't accept it on the project's behalf. `make_game.py` does find the versioned cross tools on Ubuntu 26.04 (`cross_tool_suffix() == '-21'`; `clang-cl-21` comes from `clang-21` there, `clang-tools-<N>` on 24.04), and lists only the missing xwin SDK. A CI job for the cross-build is a maintainer decision for the same licence reason. - **No native ELF `gta6rt`**: documented limitation above, not attempted. - **PowerShell research helpers have no shell equivalent**: `scripts/carve_all.ps1`, `first_look.ps1`, `meta_to_xml.ps1` (CodeWalker, Windows), `run_conservative_tier3_reference.ps1` (Windows D3D12 reference). None is needed by the build; `carve_all.ps1` would be the one worth porting. - **Pre-existing, not Linux-specific (finding):** `tests/test_rpf9dump_exit_codes.py`'s two blocked-write cases put a directory at `<file>.partial`, but `Util.WriteAtomic` writes to a unique `<file>.<pid>.<tid>.<guid>.partial`, so nothing is blocked: they fail on Linux, and by the code they would on Windows too (the Windows step has been skipped in every recent run, because an earlier step fails). I left the test alone and kept it out of the new Linux job; the `check` job still runs it. - **Pre-existing failures on `main`** (fail identically with and without this PR, listed above). `test_make_game_argparse.py` is the `--jobs 10` case PR #1 addresses. - i18n quickstarts are not updated (English only). ## CI commit (local, not pushed) The token I pushed with has no `workflow` scope, and GitHub refuses any push that touches `.github/workflows/`. So the last commit, `ci(linux): build the runtime with Clang, build rpf9dump on Linux, run Build.sh`, is ready but not on this branch. It adds: - `runtime.yml` → **`linux-clang`**: native Linux build + full `ctest` with Clang (`linux-gpu-tools` uses GCC only), with a check that CMake really picked Clang. - `ci.yml` → **`rpf9dump-linux`**: builds rpf9dump on Linux (the `check` job builds it on Windows only) and runs `test_ttpf_export_resume.py` and the diagnostics project. - `ci.yml` → `stdlib-tests-linux`: `./Build.sh --help`. - `docs/linux.md`: the "how it is checked" column then names those jobs. Actions are pinned to the same commits as the existing jobs. The diff is below; I'll push it as soon as the push credentials have `workflow` scope. <details><summary>Workflow diff</summary> ```diff diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aa6133..cd39927 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -269,6 +269,38 @@ jobs: - name: Viewer chunk streaming (synthetic, no browser or game data) run: node --test tests/test_*.cjs + # rpf9dump, the asset exporter, built and run on Linux: the check job builds it on Windows only, while the assets + # stage of make_game.py builds the same project on Linux (on Ubuntu 26.04 its .NET 10 SDK does it through + # global.json's latestMajor roll-forward). Every input is synthetic. tests/test_rpf9dump_exit_codes.py is not run + # here: its two blocked-write cases put a directory at <file>.partial, which Util.WriteAtomic no longer writes (it + # uses a unique <file>.<pid>.<tid>.<guid>.partial), so they fail on Linux; the check job still runs the file. + rpf9dump-linux: + needs: change-scope + if: ${{ !cancelled() && needs.change-scope.outputs.docs-only != 'true' }} + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + submodules: recursive + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 + with: + dotnet-version: "8.0.x" + cache: true + cache-dependency-path: "**/packages.lock.json" + - name: Build rpf9dump + run: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release + - name: Test TTPF export retry + env: + RPF9DUMP_DLL: tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll + run: python -I tests/test_ttpf_export_resume.py + - name: Test rpf9dump diagnostics + run: dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release + # The check job runs the standard-library loop on Windows, which has no SPIRV-Tools or numpy: the spirv-val checks # (test_split_big_switch, test_image_load_typed...), the numpy paths and the POSIX-only tests skip there. This job # runs the same loop on Linux with them installed, so those tests run somewhere. @@ -290,6 +322,9 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends spirv-tools pip install -r tests/requirements.txt + # The Linux entry point, as the check job runs make_game.py --help on Windows. + - name: Build.sh help + run: ./Build.sh --help - name: Tests (standard library only, Linux) shell: bash run: | diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index cafdf46..8b4af9f 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -496,6 +496,59 @@ jobs: fi done <<< "$names" + # The same native Linux build with Clang instead of the runner's default GCC, so a change that only one of the two + # compilers accepts shows up on a pull request. The CPU and llvmpipe runtime tests run; the GPU shader tests are + # left to linux-gpu-tools, which already runs them on llvmpipe. + linux-clang: + runs-on: ubuntu-24.04 + timeout-minutes: 20 + env: + SCCACHE_GHA_ENABLED: "true" + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 + - name: Cache Vulkan headers + id: vulkan-headers-cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: .vulkan-headers/include + key: vulkan-headers-6802bb4733b63ed5efd3adb308a6c885ef180ea1 + - name: Checkout Vulkan headers (vulkan-sdk-1.4.363.0) + if: steps.vulkan-headers-cache.outputs.cache-hit != 'true' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: KhronosGroup/Vulkan-Headers + ref: 6802bb4733b63ed5efd3adb308a6c885ef180ea1 # vulkan-sdk-1.4.363.0 + path: .vulkan-headers + sparse-checkout: include + persist-credentials: false + - name: Install Clang, the Vulkan loader and llvmpipe + run: | + pkgs=(clang libvulkan-dev mesa-vulkan-drivers) + command -v cmake >/dev/null || pkgs+=(cmake) + command -v ninja >/dev/null || pkgs+=(ninja-build) + sudo apt-get update + sudo apt-get install -y --no-install-recommends "${pkgs[@]}" + clang++ --version + - name: Configure + env: + CC: clang + CXX: clang++ + VULKAN_SDK: ${{ github.workspace }}/.vulkan-headers + run: >- + cmake -S runtime -B runtime/build -G Ninja + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DLEONIDA_REQUIRE_VULKAN=ON + - name: Check the compiler is Clang + run: grep -h 'set(CMAKE_CXX_COMPILER_ID "Clang")' runtime/build/CMakeFiles/*/CMakeCXXCompiler.cmake + - name: Build + run: cmake --build runtime/build --parallel + - name: Runtime tests (Linux, Clang) + run: ctest --test-dir runtime/build --output-on-failure -j "$(nproc)" + # Builds the runtime on an Apple Silicon Mac and runs its tests and the hand-written GPU tests on MoltenVK. The # hosted runner is a VM whose Metal device is "Apple Paravirtual device" (MTLGPUFamilyMac2, not Apple7), so # Mesa's KosmicKrisp finds no device there; MoltenVK runs, with 32-wide subgroups. macos-26, not macos-15: Xcode ``` </details> ## Try it on Linux ```sh sudo apt install git python3 llvm-21 spirv-tools dotnet-sdk-10.0 cmake ninja-build g++ libvulkan-dev git clone --recursive -b feat/linux-native-support https://github.com/bhimio1/leonida && cd leonida ./Build.sh --help python3 -I -c "import sys; sys.path.insert(0, 'tools'); import mc_command; print(mc_command.mc_command())" CC=clang CXX=clang++ cmake -S runtime -B runtime/build/linux -G Ninja && cmake --build runtime/build/linux --parallel ctest --test-dir runtime/build/linux --output-on-failure ./Build.sh --check --game /path/to/your/package # with your own copy ``` --- Written with AI assistance (Claude Code). Tested on Ubuntu 26.04 x86-64 with no GPU: Mesa lavapipe (llvmpipe, LLVM 21.1.8), GCC 15.2, Clang 21.1, .NET SDK 10.0.115. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:21 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
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
starred/leonida#279
No description provided.