RFR: 8346394: Bundled freetype library needs to have JNI_OnLoad for static builds

Magnus Ihse Bursie ihse at openjdk.org
Tue Dec 17 12:59:24 UTC 2024


All JDK native libraries needs to have a proper `JNI_OnLoad`, set either by `DEF_STATIC_JNI_OnLoad` or `DEF_JNI_OnLoad`. This is so that in a static build, the JVM can recognize that the library is already loaded, and does not try to load a (non-existent) external library.

Our bundled version of freetype is missing such a marker.

This turns out to be a problem just on Windows, since the `System.loadLibrary("freetype")` code in `FontManagerNativeLibrary` is only executed on Windows. However, the cost of including this in the bundled versions on all platforms is very small, and it is a safeguard for any future changes. In practice, freetype bundling is only enabled on Windows anyways.

-------------

Commit messages:
 - 8346394: Bundled freetype library needs to have JNI_OnLoad for static builds

Changes: https://git.openjdk.org/jdk/pull/22791/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22791&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8346394
  Stats: 6 lines in 2 files changed: 1 ins; 3 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/22791.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22791/head:pull/22791

PR: https://git.openjdk.org/jdk/pull/22791


More information about the build-dev mailing list