mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:50:53 +01:00
[PR #227] [MERGED] Linux: versioned llvm-mc, Build.sh/Mods.sh, case diagnostic, portable runtime tests, docs/linux.md #279
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#279
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 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)
fca3be7fix(linux): find a versioned llvm-mc and give Linux install hints5a8af54build(linux): add Build.sh and Mods.sh, the shell counterparts of Build.bat and Mods.batb556acbfix(linux): name a version probe file whose name differs only in case6fbb25ebuild(linux): build the portable root-signature and host CPU tests on every OS8e9708fdocs(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.pywas 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 editsmake_game.py, in an unrelated part).What changed and why
fix(linux): llvm-mc on Debian/Ubuntu (tools/mc_command.py,tools/shader_disasm.py,make_game.py).apt install llvm-21installsllvm-mc-21and/usr/lib/llvm-21/bin/llvm-mc, never a plainllvm-mc, so the shaders stage stopped with Windows-only advice (scripts\build_llvm_mc.ps1, WSL).tests/conftest.pyalready found the versioned install, so the pytest suites passed wheremake_game.pyfailed. WithLLVM_MCunset,mc_command()still uses the plain name when it is onPATH(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. Editingshader_disasm.pychanges 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_SOURCESdoesn't include it).build(linux):Build.shandMods.sh, the counterparts ofBuild.batandMods.bat: they find Python 3.12+ (versionedpython3.Nfirst) and runmake_game.py/ the mod manager window with-Iand every argument passed through. They install and download nothing. The mod manager's missing-Tkinter message now namespython3-tkoff Windows.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.build(linux): portable runtime tests.src/root_signature.hsays it "compiles on Linux CI" andsrc/host_cpu.cppalready had its POSIX branches, butroot_signature_testandhost_cpu_testwere inside the Windows-only CMake block. They now build on every OS (MSVC keeps its flags);host_cpu_testusessetenv/unsetenvoff Windows.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.0builds rpf9dump throughglobal.json's roll-forward, verified below),./Build.sh, the cross-build, and why there is no native Linuxgta6rt(below). Linked from README anddocs/README.md.ci(linux): not in this branch yet, see "CI commit" below.Why the runtime stays a Windows program (documented limitation)
A native ELF
gta6rtis 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.dllalone 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 inmain.cpp), and the shims are written againstwindows.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.ctest70/70 passed (2 skipped:shader_library_corpusneeds game data,vk_sync_validationneeds the validation layer). After the CMake change, the two moved tests also build and pass under GCC.ctest72/72 passed (same 2 skips).root_signature_test(56/56 checks) andhost_cpu_testpass under GCC and Clang.LLVM_MC:mc_command()→['/usr/bin/llvm-mc-21']here; newVersionedLlvmMcTestcases (fake install layouts, numeric version order,llvm-mcanot mistaken for llvm-mc, plain name kept,LLVM_MCwins).tests/test_mc_command.py,test_shader_disasm.py,test_make_game_preflight.py,test_make_game_platform.pypass../Build.sh --helpand./Mods.sh --helprun through the system Python;tests/test_shell_launchers.py(stub interpreters on a privatePATH: picks the first 3.12+, passes awkward arguments through unchanged, exit code comes back, message when none) passes;shellcheck -s shis clean.tests/test_make_game_preflight.py.dotnet build tools/rpf9dump/rpf9dump.csproj -c Releasesucceeds (0 warnings);tests/test_ttpf_export_resume.pypasses;tests/Rpf9DumpDiagnosticspasses.tests/test_docs_*.py,test_i18n_index.py) pass, as doestests/test_ci_registration.py.main(9ec34cd) on this machine, with CI'sLLVM_MC=/usr/lib/llvm-21/bin/llvm-mcandLEONIDA_REQUIRE_SPIRV_TOOLS=1: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).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.test_user_sgpr_census.py::test_json_report_refuses_to_overwrite_index[folding-volume-case]).Not done / untested
shellcheckand the YAML parses; each job mirrors a command run locally above.make_game.py's shaders/assets/pipelines stages on a real package on Linux, the case diagnostic against a real copy, and anythinggta6rtdoes with the retail executable.scripts/run_gpu_tests.pywas not run on this branch (the existinglinux-gpu-toolsjob covers it on llvmpipe; this PR doesn't change the translator).make_game.pydoes find the versioned cross tools on Ubuntu 26.04 (cross_tool_suffix() == '-21';clang-cl-21comes fromclang-21there,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.gta6rt: documented limitation above, not attempted.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.ps1would be the one worth porting.tests/test_rpf9dump_exit_codes.py's two blocked-write cases put a directory at<file>.partial, butUtil.WriteAtomicwrites 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; thecheckjob still runs it.main(fail identically with and without this PR, listed above).test_make_game_argparse.pyis the--jobs 10case PR #1 addresses.CI commit (local, not pushed)
The token I pushed with has no
workflowscope, 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 + fullctestwith Clang (linux-gpu-toolsuses GCC only), with a check that CMake really picked Clang.ci.yml→rpf9dump-linux: builds rpf9dump on Linux (thecheckjob builds it on Windows only) and runstest_ttpf_export_resume.pyand 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
workflowscope.Workflow diff
Try it on Linux
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.