Skip to content

build: deploy Linux native as libpinmame.so - #39

Draft
dcbenji wants to merge 1 commit into
VisualPinball:masterfrom
dcbenji:fix/linux-libpinmame-name
Draft

dcbenji wants to merge 1 commit into
VisualPinball:masterfrom
dcbenji:fix/linux-libpinmame-name

Conversation

@dcbenji

@dcbenji dcbenji commented Oct 11, 2026

Copy link
Copy Markdown

AI disclosure: this PR was written and submitted by an AI (Claude, Anthropic) working in Ben's (dcbenji) Claude Code session. Root-cause analysis, code change and this description are AI-authored; Ben asked for it after freezy's request on Discord and tested it on his Linux machine. Please review it with that in mind.

Problem

On Linux, entering Play mode with the PinMAME gamelogic engine fails with DllNotFoundException: libpinmame.so in PinMameApi.IsRunning() (from OnInit). Nothing runs.

Root cause

PinMameDotNet.dll from runtimes/linux P/Invokes exactly libpinmame.so, but the PinMame.Native.linux-x64 package ships only libpinmame.so.3.7.0 (SONAME libpinmame.so.3.7.0). PluginsDeploy copies native/* unchanged, so Unity never finds a library with the expected name. CI copies the same Plugins/linux-x64 folder into the UPM package, so the published package likely has the same problem. Windows already has the equivalent fix (pinmame64.dll copied as pinmame.dll).

Fix (csproj + meta rename)

  • For linux-x64, stop copying native/* as-is and copy libpinmame.so.* to Plugins/linux-x64/libpinmame.so instead (same RenamedPlugins mechanism as win-x64).
  • Delete a stale libpinmame.so.<version> left by older builds (.meta files are excluded from the glob).
  • git mv libpinmame.so.3.7.0.meta libpinmame.so.meta, keeping the GUID and the Editor + Linux64 importer settings.

macOS likely has the same mismatch (the binding imports libpinmame.dylib, the package ships libpinmame.3.7.0.dylib; a manual symlink was needed on a Mac in March). Not changed here because it couldn't be tested.

How tested (Ubuntu 24.04, Unity 6000.5.0f1)

  • dotnet build VisualPinball.Engine.PinMAME/VisualPinball.Engine.PinMAME.csproj -c Release -r linux-x64 with a stale libpinmame.so.3.7.0 seeded in the folder: 0 errors; Plugins/linux-x64 contains libpinmame.so (byte-identical to the NuGet native) + libpinmame.so.meta, PinMameDotNet.dll, VisualPinball.Engine.PinMAME.dll; the versioned copy is removed.
  • With vpe-terminator2: before, DllNotFoundException: libpinmame.so; after, PinMAME starts, Game started., and the game plays (coin, start, trough eject, plunger, drain, next ball). The in-editor test used a hand-made .meta; this PR keeps the original GUID via the rename, with the same importer settings.

🤖 Generated with Claude Code

PinMameDotNet P/Invokes libpinmame.so on Linux, but the linux-x64
native package ships libpinmame.so.<version> only, so Unity can't load
PinMAME (DllNotFoundException). Copy it as libpinmame.so (same
RenamedPlugins mechanism as win-x64), delete stale versioned copies,
and rename the .meta to keep its GUID and importer settings.

Written and submitted with AI (Claude); tested by Ben on Ubuntu 24.04.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High impact] Changes native library deployment for Linux builds.

The PR appears safe to merge, with one non-blocking update needed in the development instructions.

Summary

The Linux build now deploys the native library as libpinmame.so, matching the name requested by the managed bridge.

  • Linux builds place PinMAME's native library under the name Unity loads.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["NuGet: libpinmame.so.version"] --> B["PluginsDeploy"]
  B --> C["Unity: libpinmame.so"]
  D["libpinmame.so.meta"] --> C
  B --> E["Remove stale versioned binaries"]
Loading

Reviews (1) · Last reviewed commit: "build: deploy Linux native as libpinmame..." · Reviewed by Greptile

@greptile-apps

greptile-apps Bot commented Oct 11, 2026

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Setup command names removed file VisualPinball.Engine.PinMAME.Unity/Plugins/linux-x64/libpinmame.so.meta:2 ▶

    The rename leaves README.md:46 pointing to libpinmame.so.3.7.0.meta, which no longer exists. The documented git update-index --assume-unchanged command now fails and does not protect the renamed file from accidental changes. Update that command to use libpinmame.so.meta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant