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

Magnus Ihse Bursie ihse at openjdk.org
Wed Dec 18 10:17:42 UTC 2024


On Wed, 18 Dec 2024 04:48:53 GMT, David Holmes <dholmes at openjdk.org> wrote:

> A bit late but why do we presume that just because this library is bundled that it has to be part of the static image?

No? The library can be bundled as a dynamic library as well, that has always been and still is the case.

> This static build stuff continues to leave me with a "bad taste in my mouth".

I agree that the static build stuff is still not up to normal JDK standards. It was originally "tacked on" from the side, with a lot of kludges to get it to work. I am trying to work through these problematic cases and clean up the code. 

This current kludge is that there is a lot of code doing System.loadLibrary(someInternalLibrary), and for static builds these calls should really be a no-op. But how do you know? The solution chosen by the original implementors of static builds was to look for a symbol JNI_OnLoad_someInternalLibrary, and if it was found, skip loading the dynamic library. It can certainly be discussed if this was a good way of doing things, but that is how it currently works. (It does have the advantage that users can add static libraries of their own in this way.)

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

PR Comment: https://git.openjdk.org/jdk/pull/22791#issuecomment-2550922542


More information about the build-dev mailing list