adoptium / adoptium-support

For end-user problems reported with our binary distributions
Apache License 2.0
45 stars 15 forks source link

Linking with /lib/runtime/lib with jpackage temurin jdk19 #733

Open tilkinsc opened 1 year ago

tilkinsc commented 1 year ago

Please provide a brief summary of the bug

From LD_DEBUG=all I can see that java is attempting to load my so from a few directories all uncontrollable, but nowhere in the actual jre directory like it would normally in /usr/lib/jvm/temurin-jdk19/lib.

cat debug.txt | grep "libjawt.so"
     25628: file=libjawt.so [0];  needed by /home/user/lib/libjaggie.so [0]
     25628: find library=libjawt.so [0]; searching
     25628:   trying file=/lib/x86_64-linux-gnu/libjawt.so
     25628:   trying file=/usr/lib/x86_64-linux-gnu/libjawt.so
     25628:   trying file=/lib/libjawt.so
     25628:   trying file=/usr/lib/libjawt.so

It is worth noting that you will receive an unsatisfiedlink exception due to the dependency libjawt.so not being loaded, and in turn failing the native library. java.library.path is not a resolution to this issue.

Please provide steps to reproduce where possible

  1. link an so against libjawt.so that exports a java native to use
  2. jpackage --main-jar ~/Downloads/test.jar --runtime-image /usr/lib/jvm/temurin-19-jdk-amd64/ --name Testing --input ~/test --dest ~/jpack --type app-image
  3. ~/jpack/Testing/bin/test

Expected Results

I expect the java core libraries to be loaded as its depended on without manual linkage or setting LD_LIBRARY_PATH or other hacky nonsense.

Actual Results

Let the hacky nonsense ensue.

What Java Version are you using?

openjdk version "18.0.2-ea" 2022-07-19

What is your operating system and platform?

Ubtuntu jammie 22.04.2 LTS via VirtualBox

How did you install Java?

Installed via apt install after adding repository and gpg key.

Did it work before?

Unknown, probably not.

Did you test with the latest update version?

Yes

Did you test with other Java versions?

No

Relevant log output

java.lang.UnsatisfiedLinkError: /home/user/lib/libjaggie.so: libjawt.so: cannot open shared object file: No such file or directory
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404)
    at java.base/java.lang.Runtime.load0(Runtime.java:785)
    at java.base/java.lang.System.load(System.java:2011)
    at java.base/java.lang.Thread.run(Thread.java:1589)
karianna commented 1 year ago

@tilkinsc OpenJDK 18.0.2 is no longer under support. Can you try 19.0.2 and see if the problem persists?

tilkinsc commented 1 year ago

I am I just targeted the wrong one when I generated the version without thinking

github-actions[bot] commented 1 year ago

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

tilkinsc commented 1 year ago

Stale needs removed

karianna commented 1 year ago

Note to anyone picking this up for triage - will need to test this with latest 20