JDK-8294394 : running jlink in GraalVM must copy libgraal into the output image
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jlink
  • Affected Version: 20
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2022-09-26
  • Updated: 2022-09-26
Related Reports
Relates :  
Description
To build libgraal, a base GraalVM image (GVM1) is used to run Native Image. The final libgraal-enabled GraalVM image (GVM2) is produced by copying GVM1 and overlaying it with the libgraal library. That is, the libgraal artifact (e.g., lib/libjvmcicompiler.so) in GVM2 is not deployed by jlink. When running jlink in GVM2, this artifact must be copied into the output image so that the output image is a Java runtime that includes and uses libgraal as the top tier compiler.

One solution would be to package libgraal in a new module and introduce a further jlink step to produce GVM3. However, this would slow down the GraalVM build process as running jlink to produce a complete JDK image takes time. What's more, it also means the footprint of libgraal is paid for twice in a GraalVM JDK; once in lib/libjvmcicompiler.so and again packaged in a jmod file.

A preferred solution would be to add a jlink plugin that can copy specified files from the current image into the output image.