Skip to content

Fix macOS LinkageError from shaded Jna-platform conflicting with Minecraft#46

Open
leventecsordas wants to merge 1 commit into
thevortex:26.1from
leventecsordas:26.1
Open

Fix macOS LinkageError from shaded Jna-platform conflicting with Minecraft#46
leventecsordas wants to merge 1 commit into
thevortex:26.1from
leventecsordas:26.1

Conversation

@leventecsordas

Copy link
Copy Markdown

Summary

Fixes #43.

On macOS (Apple Silicon, MC 26.1.2+), the client could crash shortly after launch with a java.lang.LinkageError when fullscreen/window mode was updated. Two class loaders were loading different copies of com.sun.jna.Pointer — one from the mod's shadow JAR and one from Minecraft's runtime libraries used by MacosUtil / ca.weblite.objc.

This removes jna-platform from the shadow configuration. Minecraft 26.1+ already ships jna and jna-platform 5.17.0 on all platforms, so jDRPC (Discord RPC) can use the game's copy at runtime.

Changes

  • Stop shading net.java.dev.jna:jna-platform:5.17.0 into the mod JAR
  • Add a comment in build.gradle explaining why JNA must not be bundled

Impact

Platform Discord RPC Risk
macOS Uses UnixConnection (no JNA) Fixes the crash
Linux Uses UnixConnection (no JNA) No change
Windows Uses WindowsConnection (JNA) Uses Minecraft's bundled JNA

JAR size drops from ~3.6 MB to ~375 KB.

Stop bundling jna-platform in the shadow JAR so Discord RPC uses the
game's JNA copy and avoids LinkageError on fullscreen handling (thevortex#43).
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