Bug 1659192

Summary: jlink produced custom images (potentially) have distro integrated native libraries
Product: [Fedora] Fedora Reporter: Severin Gehwolf <sgehwolf>
Component: java-11-openjdkAssignee: Severin Gehwolf <sgehwolf>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: jerboaa, jvanek, mvala
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-13 15:12:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Severin Gehwolf 2018-12-13 19:23:47 UTC
Description of problem:

Distribution builds of OpenJDK 11 on Fedora are tightly integrated with system libraries. For example the following configure switches are being used for Fedora builds: --enable-system-nss --with-zlib=system --with-libjpeg=system --with-giflib=system --with-libpng=system --with-lcms=system. That is, the JDK depends on certain system libraries and versions. Example:

$ ldd $(rpm -ql java-11-openjdk-headless | grep liblcms.so) | grep lcms2
	liblcms2.so.2 => /lib64/liblcms2.so.2 (0x00007fd73cd8d000)
$ rpm -qf /lib64/liblcms2.so.2
lcms2-2.9-4.fc28.x86_64

Yet, one design goal of jlink and related tools is to:
1. Download a JDK build on system A
2. Create a custom JDK image for system B on system A

System A and system B might not be the same platform: System A => Linux, system B => Windows. Or it might even be a different architecture: System A => Linux x86_64, System B => Linux aarch64. The premise seems to be that the JDKs produced are most portable (statically linked and bundled libraries). When distribution builds are being attempted to be used as a basis via the -jmods sub-package most assumptions no longer hold. That is, the java-11-openjdk package build is being used as the "downloaded JDK" build in 1) above.

Version-Release number of selected component (if applicable):
java-11-openjdk-11.0.1.13

Example illustrating this issue:

$ /usr/lib/jvm/java-11-openjdk/bin/jlink \
   --add-modules java.desktop
   --verbose \
   --strip-debug \
   --compress 2 \
   --no-header-files \
   --no-man-pages  \
   --output custom-jdk-image

$ find custom-jdk-image/lib/ | grep liblcms.so
custom-jdk-image/lib/liblcms.so
$ ldd custom-jdk-image/lib/liblcms.so | grep lcms2
ldd: warning: you do not have execution permission for `custom-jdk-image/lib/liblcms.so'
	liblcms2.so.2 => /lib64/liblcms2.so.2 (0x00007f676f1ff000)

Comment 2 Michal Vala 2018-12-19 07:40:10 UTC
"System A => Linux, system B => Windows" and "System A => Linux x86_64, System B => Linux aarch64" are cross-compile scenarios, which is different from this issue and even fully static builds won't help here. Jlink images contains full runtime with native bits, so it's always bound with OS and arch. You can't use same image on multiple systems.
Cross-compilation is possible, but you would need to have full JDK somewhere on system and tell jlink to use it. Such created image won't work on your system though.

Comment 3 Severin Gehwolf 2018-12-19 09:11:01 UTC
(In reply to Michal Vala from comment #2)
> "System A => Linux, system B => Windows" and "System A => Linux x86_64,
> System B => Linux aarch64" are cross-compile scenarios, which is different
> from this issue and even fully static builds won't help here. Jlink images
> contains full runtime with native bits, so it's always bound with OS and
> arch. You can't use same image on multiple systems.
> Cross-compilation is possible, but you would need to have full JDK somewhere
> on system and tell jlink to use it. Such created image won't work on your
> system though.

That's not what I was saying (using the same JDK image across platforms). What
I was trying to say was that you can *create* the image for a different system
provided you have the JDK bundle for "different system" also downloaded on the
local system. You'd always need two JDKs in that case: One for the system you
run jlink on, one for the target system.

So for "System A => Linux, system B => Windows" it would be:

1. Be sure you have JDK version X with jlink on System A (Linux).
2. Download JDK version X for System B (Windows).
3. Extract JDK from step 2 on your local System A, say to
   /path/to/win/jdk
4. Use jlink on System A with --module-path /path/to/win/jdk/jmods
   in order to create the custom image for System B on System A.

The same is true for the Linux x86_64 => Linux aarch64 case. They call this
cross-targetting[1].

Note: The issue at hand here is, that this might even break on *same* OS-arch pairs. That is,
distribution builds which are dynamically linked to system libs, to target the same OS-arch on a
*different* distribution. Example: Using the JDK on Fedora 28 (Linux-x86_64), create
a custom image, and try to run it on Centos 7 (Linux-x86_64).

[1] https://stackoverflow.com/questions/47593409/create-java-runtime-image-on-one-platform-for-another-using-jlink

Comment 4 Ben Cotton 2019-10-31 20:17:30 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2019-11-27 20:25:27 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Ben Cotton 2021-11-04 16:19:26 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2022-11-29 16:45:59 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 8 Ben Cotton 2022-12-13 15:12:47 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.