Unable to load libgettextlib.dll from MSYS2 MINGW64 #319

Closed
opened 2026-01-15 05:09:17 +01:00 by ibnu-ja · 2 comments
ibnu-ja commented 2026-01-15 05:09:17 +01:00 (Migrated from github.com)
Caused by: org.javagi.interop.InteropException: Could not load library libgettextlib.dll
	at org.javagi.interop.LibLoad.loadLibrary(LibLoad.java:156)
	at org.javagi.interop.Interop.loadLibrary(Interop.java:90)
	at org.javagi.util.Intl.<clinit>(Intl.java:79)
	... 1 more

github.com/jwharm/java-gi@3844225632/modules/glib/src/main/java/org/javagi/util/Intl.java (L79)

looks like it's hardcoded. My actual dll name is:

$ which libgettextlib-0-26.dll
/mingw64/bin/libgettextlib-0-26.dll

Since I build from source, I can modify it to load my version. I could help if you have specific direction on how to load the library (like what you did with linux's tryLoadLibraryVersions()).

``` Caused by: org.javagi.interop.InteropException: Could not load library libgettextlib.dll at org.javagi.interop.LibLoad.loadLibrary(LibLoad.java:156) at org.javagi.interop.Interop.loadLibrary(Interop.java:90) at org.javagi.util.Intl.<clinit>(Intl.java:79) ... 1 more ``` https://github.com/jwharm/java-gi/blob/384422563240fd15f49a885058a977e87b6dc49b/modules/glib/src/main/java/org/javagi/util/Intl.java#L79 looks like it's hardcoded. My actual dll name is: ```bash $ which libgettextlib-0-26.dll /mingw64/bin/libgettextlib-0-26.dll ``` Since I build from source, I can modify it to load my version. I could help if you have specific direction on how to load the library (like what you did with linux's `tryLoadLibraryVersions()`).
jwharm commented 2026-01-17 15:15:47 +01:00 (Migrated from github.com)

Thanks for the feedback!

I changed the Linux-specific tryLoadLibraryVersions() workaround to also be used on Windows and macOS, see PR #320. You can set your local library directory with the command-line parameter -Djavagi.library.path=/mingw64/bin/libgettextlib-0-26.dll. (See also the updated build.gradle in the java-gi-app-template repository for an example).

Can you test PR #320 and let me know if this fixes the issue?

Thanks for the feedback! I changed the Linux-specific `tryLoadLibraryVersions()` workaround to also be used on Windows and macOS, see PR #320. You can set your local library directory with the command-line parameter `-Djavagi.library.path=/mingw64/bin/libgettextlib-0-26.dll`. (See also the updated [build.gradle](https://github.com/jwharm/java-gi-app-template/blob/main/build.gradle#L39-L55) in the `java-gi-app-template` repository for an example). Can you test PR #320 and let me know if this fixes the issue?
ibnu-ja commented 2026-01-19 11:59:59 +01:00 (Migrated from github.com)

I think it works. The only thing is both java.library.path and javagi.library.path does not work on Windows. I can load the library with PATH variable PATH="%PATH%;C:\\msys64\\mingw64\\bin", not with java.library.path and javagi.library.path.

I dig around and found this issue. They said it's intended.
https://bugs.openjdk.org/browse/JDK-8311090
https://bugs.openjdk.org/browse/JDK-8339367

But good enough since they are unrelated. You can close this issue when #320 is merged.

I think it works. The only thing is both `java.library.path` and `javagi.library.path` does not work on Windows. I can load the library with `PATH` variable `PATH="%PATH%;C:\\msys64\\mingw64\\bin"`, not with `java.library.path` and `javagi.library.path`. I dig around and found this issue. They said it's intended. https://bugs.openjdk.org/browse/JDK-8311090 https://bugs.openjdk.org/browse/JDK-8339367 But good enough since they are unrelated. You can close this issue when #320 is merged.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
java-gi/java-gi#319
No description provided.