adoptium / adoptium/adoptium-support
Linking with /lib/runtime/lib with jpackage temurin jdk19
- Dominant language
- No language data
- Stars
- 59
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
### 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?
```Shell
Unknown, probably not.
```
### Did you test with the latest update version?
```Shell
Yes
```
### Did you test with other Java versions?
```Shell
No
```
### Relevant log output
```Shell
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)
```
Contributor guide
Research direction
Start by reproducing the jpackage command on Ubuntu 22.04 and inspect the generated Testing/bin/test launcher, using LD_DEBUG output to trace libjawt.so and libjaggie.so resolution. Compare the packaged runtime's behavior with the reported UnsatisfiedLinkError; done means the dependency-loading behavior and any required launcher or runtime change are verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100