Skip to content

Commit 08b4294

Browse files
committed
fix(graalvm): embed UTF-8 active code page in Windows manifest
Native-image apps (BellSoft Liberica NIK 25) crash with UnsatisfiedLinkError: Can't load library: awt when installed under a Windows path containing non-ASCII characters (Hebrew/Arabic/Cyrillic/CJK usernames or app paths). The root cause is a SubstrateVM bug (oracle/graal#8095, #10237) where path strings are passed to LoadLibraryA with UTF-8 bytes that the system ANSI codepage then reinterprets, producing a mojibake'd path. Augment the existing Windows side-by-side fusion manifest already embedded via rc.exe with <activeCodePage>UTF-8</activeCodePage> (Windows 10 1903+), the workaround explicitly recommended by the GraalVM maintainers. With GetACP() returning 65001, LoadLibraryA bytes are interpreted as UTF-8 and the bug is bypassed. Also opt into <longPathAware>true</longPathAware> for paths beyond MAX_PATH. Verified by reproducing the crash from C:\Users\Public\אבג-test\... and confirming the rebuilt binary boots cleanly from the same path.
1 parent 60469a3 commit 08b4294

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

plugin-build/plugin/src/main/kotlin/io/github/kdroidfilter/nucleus/desktop/application/internal/configureGraalvmApplication.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,14 @@ internal fun JvmApplicationContext.configureGraalvmApplication() {
293293
val v3 = versionParts.getOrElse(2) { 0 }
294294
val v4 = versionParts.getOrElse(3) { 0 }
295295

296-
// Generate DPI-aware application manifest
296+
// Generate Windows side-by-side fusion manifest:
297+
// - DPI awareness (Per-Monitor V2)
298+
// - activeCodePage = UTF-8 (Windows 10 1903+) — works around a SubstrateVM
299+
// bug where LoadLibraryA receives UTF-8 bytes interpreted as the system
300+
// ANSI codepage, breaking native-image apps installed under non-ASCII
301+
// paths (Hebrew/Arabic/Cyrillic/CJK usernames). See oracle/graal#8095
302+
// and #10237 — the GraalVM team explicitly recommends this manifest.
303+
// - longPathAware: opt into >MAX_PATH paths.
297304
val manifestFile = File(rcDir, "dpiaware.manifest")
298305
manifestFile.writeText(
299306
"""
@@ -304,6 +311,8 @@ internal fun JvmApplicationContext.configureGraalvmApplication() {
304311
| <asmv3:windowsSettings>
305312
| <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
306313
| <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
314+
| <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
315+
| <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
307316
| </asmv3:windowsSettings>
308317
| </asmv3:application>
309318
|</assembly>

0 commit comments

Comments
 (0)