Skip to content

Release: keep the bundled engine's binaries as built, so shader builds start - #353

Merged
v0lumehi merged 5 commits into
LNPANDY:mainfrom
Dino0005:fix/engine-signing
Nov 1, 2026
Merged

v0lumehi merged 5 commits into
LNPANDY:mainfrom
Dino0005:fix/engine-signing

Conversation

@Dino0005

Copy link
Copy Markdown
Contributor

Fix or feature

  • Fix
  • Feature

What and why

Symptom. With the engine the release bundles, every game build stops at the shader step:

Build failed — see the log below. Last line: [RED] own_compilers.py exit code 1
[RED] translation chain tools do not match the lock file: spirv-cross: lock e37945d8e441d34d / actual 903cd20a04dad7b0

Cause. "Assemble the bundle" in build-mac-app.yml re-signs every Mach-O file of Contents/Resources/engine with codesign --force --sign -. codesign rewrites the signature inside the file, and dm/gfx/tools/dmsh_chain.lock pins spirv-cross by the SHA-256 of its bytes (tool_lock.py), so the bundled spirv-cross no longer matches its own lock. The launcher copies that tree to ~/Library/Application Support/NX2Apple/engine/<id>/, and own_compilers.py stops there. The released zip shows it:

v0.7.5 NX2Apple-macOS-arm64.zip SHA-256 (first 16)
engine/dm/gfx/tools/dmsh_chain.lock, spirv-cross line e37945d8e441d34d
engine/dm/gfx/tools/spirv_cross_bin/spirv-cross in the same zip 494d7b19af07fbc3

The translator's apphost (dmsh_xlate) is re-signed the same way. The lock does not pin it, so it does no harm, but it is not the file the zip asset holds either. v0.8.0-rc1 still has the loop (build-mac-app.yml line 238), so 0.8.0 would ship the same tree.

The upstream binaries are already signed: spirv-cross by the linker (flags=0x20002(adhoc,linker-signed)) and the apphost ad-hoc (flags=0x2(adhoc)). Apple silicon runs them as they are, so the re-signing is not needed.

Change.

  • New frontend/tools/sign_engine_tree.sh, beside bundle_tools.sh and check_bundle.sh. It signs only a Mach-O file of the engine tree that has no signature at all and leaves every other file as built. Then it checks that each file of the bundle's engine is byte for byte the tree's (or, when it had no signature, that it now verifies), that spirv-cross matches dmsh_chain.lock, and that spirv-cross carries a signature.
  • "Assemble the bundle" calls it instead of the loop. "Check the bundled tools from the assembled bundle" runs sign_engine_tree.sh --check, so a release whose engine differs from the zip asset's tree, or whose spirv-cross does not match the lock, fails before it is uploaded.

Checked

  • sign_engine_tree.sh on the real engine tree (c5fe6b5…, as tools/engine.py tree writes it), on an Apple M3 Pro, macOS 27.2:
    • the tree as built: passes, nothing re-signed
    • spirv-cross re-signed as the old loop does: fails with changed in the bundle: dm/gfx/tools/spirv_cross_bin/spirv-cross and spirv-cross is 903cd20a04dad7b0, dmsh_chain.lock says e37945d8e441d34d
    • an extra executable with its signature removed: signed, then passes
    • a locally assembled NX2Apple.app: passes, and codesign -v --deep --strict on the bundle holds with the engine files left as built
  • With that app, the game build that had stopped at own_compilers.py exit code 1 passes the tool check and runs the shader steps.
  • The workflow YAML parses. The pre-push hook's checks pass on this branch (main fc3baab).
  • Not checked: the workflow itself on GitHub's runner, which only runs on a tag or a PR here.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#..., or pending until that PR is open
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…s start

The release re-signed every Mach-O file of Contents/Resources/engine with
codesign --force --sign -. codesign rewrites the signature inside the file,
and dm/gfx/tools/dmsh_chain.lock pins spirv-cross by the SHA-256 of its
bytes, so every shader build from the bundled engine stopped with
"translation chain tools do not match the lock file: spirv-cross"
(own_compilers.py exit code 1). The 0.7.5 zip carries spirv-cross
494d7b19af07fbc3 while its own lock says e37945d8e441d34d.

The upstream binaries are already signed (spirv-cross by the linker, the
translator's apphost ad-hoc), which Apple silicon runs as they are.
frontend/tools/sign_engine_tree.sh signs only a Mach-O file that has no
signature, and its --check mode, run in the bundle check step, fails the
release when an engine file differs from the zip asset's tree or spirv-cross
does not match the lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added launcher The NX2Apple launcher app ci Workflows and repository tooling labels Oct 31, 2026
@Dino0005 Dino0005 changed the title Release: keep the bundled engine's binaries as built, so shader build… Release: keep the bundled engine's binaries as built, so shader builds start Oct 31, 2026
LNPANDY#355 skipped spirv-cross in the signing loop and added a cmp. sign_engine_tree.sh replaces that loop and checks every file of the bundle, so its side stays.
@v0lumehi

Copy link
Copy Markdown
Collaborator

Hi @Dino0005, #355 changed the same lines in build-mac-app.yml (it skipped spirv-cross in the signing loop and added a cmp). I merged main into your branch and kept your side: sign_engine_tree.sh replaces that loop, and its check covers the cmp. Nothing else changed (merge commit f8307c4). I will merge this once CI is green.

@v0lumehi
v0lumehi merged commit 52c5212 into LNPANDY:main Nov 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Workflows and repository tooling launcher The NX2Apple launcher app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants