Idea: preserve reusable build outputs after unrelated post-link failures #1076

Closed
opened 2026-11-16 06:32:47 +00:00 by BeanIssues · 0 comments
Collaborator

Reported on Discord

What happened

A change to the repository's own renderer code (functions in the mkwvk namespace) left five symbols undefined. The build linked, then the renderer check in nx2/build.py (check_vk_symbols) rejected longshot_vk.so:

linked /home/<user>/.cache/longshot-builder/sa/build/longshot: 509 MB (2s)
longshot_vk.so has 5 unresolved symbol(s); it would not load:
    _ZN5mkwvk12_GLOBAL__N_116memory_late_syncEP17VkCommandBuffer_T
    _ZN5mkwvk12_GLOBAL__N_117memory_late_deferEb
    _ZN5mkwvk12_GLOBAL__N_119memory_late_pendingEv
    _ZN5mkwvk14upload_cmd_popEv
    _ZN5mkwvk15upload_cmd_pushEP17VkCommandBuffer_T
  a host function wants __attribute__((weak)); one of our own globals wants an extern at
  namespace scope, not inside an anonymous namespace
@@error build.py stopped (exit status 1):   namespace scope, not inside an anonymous namespace
the build failed: the next one translates and compiles the game again (nothing of this one is reused)

The fix for that error was in the repository's own code, but the next build translated and compiled the whole game again.

Where it comes from

nx2/make_game.py, forget_failed_build(work, linked, failed): when linked is true (the link or any step after it failed), it removes the lift key, takes the objects out of the object store, and deletes objcache and sa/build/obj. This was added in ac4fb52d ("a failed build drops its compiled objects too, not only the lift"), for Hookshot issue 1197, where a cached runtime object from another version linked and left a64_dirty/a64_icall/a64_lookup/recomp_cntpct undefined at every try.

A failure before the link already has a narrower path: when every file in failed is a repository source (host/, gpu/, third_party/), the translation is kept. A failure after the link has no such path, so the renderer symbol check, which only looks at the repository's own code, wipes everything.

The idea

After a post-link failure, keep the translation (and the objects not involved) when the failure is plainly in the repository's own code. For example, when every unresolved symbol check_vk_symbols reports belongs to our own namespaces (mkwvk, …) and none is a game or runtime symbol. Keep the full wipe for the case issue 1197 hit.

Not known yet

The Longshot version or commit the build was made from (a build from source on Linux).

Reported on [Discord](https://discord.com/channels/1569849200047427645/1571764411356422157/1571765246530420788) ### What happened A change to the repository's own renderer code (functions in the `mkwvk` namespace) left five symbols undefined. The build linked, then the renderer check in `nx2/build.py` (`check_vk_symbols`) rejected `longshot_vk.so`: ```text linked /home/<user>/.cache/longshot-builder/sa/build/longshot: 509 MB (2s) longshot_vk.so has 5 unresolved symbol(s); it would not load: _ZN5mkwvk12_GLOBAL__N_116memory_late_syncEP17VkCommandBuffer_T _ZN5mkwvk12_GLOBAL__N_117memory_late_deferEb _ZN5mkwvk12_GLOBAL__N_119memory_late_pendingEv _ZN5mkwvk14upload_cmd_popEv _ZN5mkwvk15upload_cmd_pushEP17VkCommandBuffer_T a host function wants __attribute__((weak)); one of our own globals wants an extern at namespace scope, not inside an anonymous namespace @@error build.py stopped (exit status 1): namespace scope, not inside an anonymous namespace the build failed: the next one translates and compiles the game again (nothing of this one is reused) ``` The fix for that error was in the repository's own code, but the next build translated and compiled the whole game again. ### Where it comes from `nx2/make_game.py`, `forget_failed_build(work, linked, failed)`: when `linked` is true (the link or any step after it failed), it removes the lift key, takes the objects out of the object store, and deletes `objcache` and `sa/build/obj`. This was added in ac4fb52d ("a failed build drops its compiled objects too, not only the lift"), for Hookshot issue 1197, where a cached runtime object from another version linked and left `a64_dirty`/`a64_icall`/`a64_lookup`/`recomp_cntpct` undefined at every try. A failure before the link already has a narrower path: when every file in `failed` is a repository source (host/, gpu/, third_party/), the translation is kept. A failure after the link has no such path, so the renderer symbol check, which only looks at the repository's own code, wipes everything. ### The idea After a post-link failure, keep the translation (and the objects not involved) when the failure is plainly in the repository's own code. For example, when every unresolved symbol `check_vk_symbols` reports belongs to our own namespaces (`mkwvk`, …) and none is a game or runtime symbol. Keep the full wipe for the case issue 1197 hit. ### Not known yet The Longshot version or commit the build was made from (a build from source on Linux).
Sign in to join this conversation.
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
MagicBeanDev/Longshot#1076
No description provided.