Skip to content

Fix: Remove GraalVM's DLLs from beside the Windows native image - #77

Open
b-re-w wants to merge 1 commit into
extendedfrom
fix/native-image-windows-leftovers
Open

b-re-w wants to merge 1 commit into
extendedfrom
fix/native-image-windows-leftovers

Conversation

@b-re-w

@b-re-w b-re-w commented Nov 25, 2026

Copy link
Copy Markdown
Member

Fixes #75.

Problem. packageNativeImage removed the libraries GraalVM copies next to the image, but only on Linux (removeUnneededLinuxLibraries). On Windows, Gemstone's gemstone.exe (LogitAI/Gemstone JetBrains#255, plugin 1.11.1-ext.3) was left with freetype.dll, java.dll, javaaccessbridge.dll, jawt.dll and jvm.dll. None of them is needed:

  • dumpbin /dependents shows the exe imports none of them, and the exe runs Gemstone's smoke test alone from an empty directory.
  • java.dll and jvm.dll are shims that a static image never opens.
  • freetype.lib and jawt.lib are linked in from the Windows static JDK archives.
  • Nothing registers or loads the Access Bridge library.

Change. A new internal object NativeImageLeftovers holds, per host, the file names the executable doesn't load:

Host Files removed
Linux libjava.so, libjvm.so, libawt_headless.so, libfreetype.so: the same as before
Windows the five DLLs above
macOS none

It removes only those names, so files the application puts there itself stay. AbstractNativeImageTask calls it for every host, in place of the Linux-only function.

Test, red first. NativeImageLeftoversTest, a new unit test, has four cases:

  • Gemstone's exact directory is left holding only gemstone.exe.
  • An unknown DLL and a .pdb are kept.
  • Linux removes the same four libraries as before.
  • macOS removes nothing.

Local runs (macOS arm64). With Windows set to remove nothing, as before this change, both Windows cases failed and the Linux and macOS cases passed. With the change, all four pass, and the existing NativeImage* unit tests pass too.

Not checked here. No local build on Windows ran; nothing in this repo builds a Windows image in CI either. Gemstone's native-desktop job checks the real output.

🤖 Generated with Claude Code

packageNativeImage removed the libraries GraalVM copies beside the image on
Linux only. On Windows, gemstone.exe was left with freetype.dll, java.dll,
javaaccessbridge.dll, jawt.dll and jvm.dll, none of which it imports or loads
(found by Gemstone: dumpbin shows none, and the exe runs alone from an empty
directory). The java and jvm shims are never opened by a static image,
freetype.lib and jawt.lib are linked in from the Windows static JDK archives,
and nothing registers the Access Bridge.

NativeImageLeftovers holds the list per host (Linux's unchanged, macOS none)
and removes only those names, so what the application puts there stays.
NativeImageLeftoversTest failed on both Windows cases with Windows removing
nothing, as before, and passes now.

Fixes #75

This branch has not been deployed

No deployments
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