fix(linux): the log says why the renderer did not load #2875

Open
github-sync wants to merge 1 commit from github/pr/2875 into main
Owner

@jordanella opened this pull request on GitHub · 2026-11-12 18:10 UTC · original

When the Linux renderer fails to load, the log says only (2). That covers a missing file and a hookshot_vk.so from another build alike, though the second is the one that needs explaining: it takes symbols from the executable, so it fails at dlopen, before mkwvk_init's version check, and the game quietly falls back to WebGPU.

Change

  • host/posix/win32_posix.c: LoadLibraryA keeps dlerror()'s text for the last failure, per thread, and hos_load_error() returns it ("" after a success). GetLastError() is still ERROR_FILE_NOT_FOUND, as before.

  • host/rx_backend.c: load_vulkan's failure line prints that text on Linux:

    rx: RX_BACKEND=vulkan, but .../hookshot_vk.so did not load (.../hookshot_vk.so: undefined symbol: mkwvk_...): WebGPU
    

    Windows keeps the error number, which already tells a missing file (126) from a missing function (127).

Part of the dev-loop proposal's B1 (#2636): a renderer swap during development needs this line to say why the new one was refused.

Testing

  • tests/test_renderer_load_error.py (new):

    • everywhere: the source keeps the text and logs it (it fails on main);
    • on Linux: builds win32_posix.c as it is and loads, through LoadLibraryA, a .dll name with no library behind it, a library that needs a symbol nothing has, then a good one.
  • The Linux part, run by hand on WSL Ubuntu (gcc), as the check does it:

    failed|2|<tmp>/absent_vk.so: cannot open shared object file: No such file or directory
    failed|2|<tmp>/needs.so: undefined symbol: mkwvk_from_another_build
    loaded|0|
    
  • Every check that reads the changed files (37), through run_all.py, rebased on today's main, on Windows: 34 pass; nx2/test_bc_storage_views.py, nx2/test_dll.py and nx2/test_leaf.py fail the same way on main here. The new check's Linux part is skipped on Windows.

  • Not run: the game on Linux. The change is the failure path's log line.

See #2636 (B1).

🤖 Generated with Claude Code

> [@jordanella](https://github.com/jordanella) opened this pull request on GitHub · 2026-11-12 18:10 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2875) When the Linux renderer fails to load, the log says only `(2)`. That covers a missing file and a `hookshot_vk.so` from another build alike, though the second is the one that needs explaining: it takes symbols from the executable, so it fails at `dlopen`, before `mkwvk_init`'s version check, and the game quietly falls back to WebGPU. ## Change - **`host/posix/win32_posix.c`:** `LoadLibraryA` keeps `dlerror()`'s text for the last failure, per thread, and `hos_load_error()` returns it (`""` after a success). `GetLastError()` is still `ERROR_FILE_NOT_FOUND`, as before. - **`host/rx_backend.c`:** `load_vulkan`'s failure line prints that text on Linux: ``` rx: RX_BACKEND=vulkan, but .../hookshot_vk.so did not load (.../hookshot_vk.so: undefined symbol: mkwvk_...): WebGPU ``` Windows keeps the error number, which already tells a missing file (126) from a missing function (127). Part of the dev-loop proposal's B1 (#2636): a renderer swap during development needs this line to say why the new one was refused. ## Testing - **`tests/test_renderer_load_error.py` (new):** - everywhere: the source keeps the text and logs it (it fails on `main`); - on Linux: builds `win32_posix.c` as it is and loads, through `LoadLibraryA`, a `.dll` name with no library behind it, a library that needs a symbol nothing has, then a good one. - **The Linux part, run by hand on WSL Ubuntu (gcc), as the check does it:** ``` failed|2|<tmp>/absent_vk.so: cannot open shared object file: No such file or directory failed|2|<tmp>/needs.so: undefined symbol: mkwvk_from_another_build loaded|0| ``` - **Every check that reads the changed files (37), through `run_all.py`, rebased on today's `main`, on Windows:** 34 pass; `nx2/test_bc_storage_views.py`, `nx2/test_dll.py` and `nx2/test_leaf.py` fail the same way on `main` here. The new check's Linux part is skipped on Windows. - **Not run:** the game on Linux. The change is the failure path's log line. See #2636 (B1). 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- github-sync:item:2875 -->
hookshot_vk.so is opened with RTLD_NOW and takes symbols from the
executable, so one from another build fails at dlopen, before
mkwvk_init's version check, and the game falls back to WebGPU. The POSIX
LoadLibraryA kept only ERROR_FILE_NOT_FOUND, so the log said "(2)" for
that and for a missing file alike. It keeps dlerror()'s text
(hos_load_error), and load_vulkan prints it:

  rx: RX_BACKEND=vulkan, but .../hookshot_vk.so did not load
  (.../hookshot_vk.so: undefined symbol: mkwvk_...): WebGPU

tests/test_renderer_load_error.py: the source everywhere; on Linux,
the shim as it is loading a missing file, a library needing a missing
symbol and a good one. Part of the dev-loop proposal's B1 (#2636).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Commenting is not possible because the repository is archived.
No description provided.