RFR: 8339480: Build static-jdk image with a statically linked launcher

Erik Joelsson erikj at openjdk.org
Tue Sep 3 18:12:22 UTC 2024


On Tue, 3 Sep 2024 12:50:01 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

> As a prerequisite for Hermetic Java, we need a statically linked `java` launcher. It should behave like the normal, dynamically linked `java` launcher, except that all JDK native libraries should be statically, not dynamically, linked.
> 
> This patch is the first step towards this goal. It will generate a `static-jdk` image with a statically linked launcher. This launcher is missing several native libs, however, and does therefore not behave like a proper dynamic java. One of the reasons for this is that local symbol hiding in static libraries are not implemented yet, which causes symbol clashes when linking all static libraries together. This will be addressed in an upcoming patch. 
> 
> All changes in the `src` directory are copied from, or inspired by, changes made in [the hermetic-java-runtime branch in Project Leyden](https://github.com/openjdk/leyden/tree/hermetic-java-runtime).

I tried to take this for a spin on my m1 mac laptop. I ran configure and then `make static-jdk-image`. The build failed with the following:


chmod: /Users/erik/dev/jdk/build/macosx-aarch64/jdk/lib/server/libjsig.dylib: No such file or directory
ModuleWrapper.gmk:81: recipe for target '/Users/erik/dev/jdk/build/macosx-aarch64/jdk/lib/server/libjsig.dylib' failed
make[3]: *** [/Users/erik/dev/jdk/build/macosx-aarch64/jdk/lib/server/libjsig.dylib] Error 1
make[3]: *** Waiting for unfinished jobs....
make/Main.gmk:191: recipe for target 'java.base-libs' failed
make[2]: *** [java.base-libs] Error 2


I'm guessing this would work if I built the regular image first, or at least at the same time.

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

PR Comment: https://git.openjdk.org/jdk/pull/20837#issuecomment-2327132241


More information about the core-libs-dev mailing list