Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303796

Optionally build fully statically linked JDK image

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • infrastructure

      In some scenarios, it's desirable to be able to create/include the JDK and VM's static libraries as part of the regular JDK build. This is a minor enhancement proposed to add the support in the JDK build system (on top of the existing JEP 178: Statically-Linked JNI Libraries work). Currently, there is no plan to create a new JEP for the enhancement work in this area.

      In one specific scenario [1], the JDK/hotspot static libraries provided by a JDK binary can be used to create a fully statically linked binary image as a post process when building Java applications.

      As part of the work, it's useful to be able to demonstrate and test the JDK static build support with a fully statically linked launcher executable (such as bin/javastatic), which is statically linked with the libjvm static library and a desired set of JDK static libraries. To achieve such a goal, some JDK/VM work would be involved in addition to the build changes, e.g.:

      - Resolve symbol issues with a fully statically linked build
      - Change assumptions with `dlopen` for libjvm

      It's also beneficial to be able to build both .so and .a from the same set of .o files. That would involve some changes to handle the dynamic JDK and static JDK difference at runtime, instead of relying on the STATIC_BUILD macro.

      Will create separate bugs/enhancements for the non-build changes.

      [1] - https://mail.openjdk.org/pipermail/leyden-dev/2023-February/000107.html

            jiangli Jiangli Zhou
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: