make/test/JtregNativeJdk.gmk explicitly link libExplicitAttach with libjvm. That's due to the direct call to JNI_GetCreatedJavaVMs in libExplicitAttach.
```
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libExplicitAttach := java.base:libjvm
```
As a result, libjvm.so is a recorded dependency of libExplicitAttach. On static JDK (static-jdk image), AttachTest_id0 fails since there is no libjvm.so for runtime:
```
Exception in thread "main" java.lang.UnsatisfiedLinkError: /<snip>/jianglizhou/github/JDK-8349178/build/linux-x86_64-server-fastdebug/images/test/jdk/jtreg/native/libExplicitAttach.so: libjvm.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:321)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:187)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:129)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:249)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:241)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2278)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.base/java.lang.System.loadLibrary(System.java:1663)
at ExplicitAttach.<clinit>(ExplicitAttach.java:60)
----------System.err:(31/2299)----------
```
This is similar toJDK-8349178.
```
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libExplicitAttach := java.base:libjvm
```
As a result, libjvm.so is a recorded dependency of libExplicitAttach. On static JDK (static-jdk image), AttachTest_id0 fails since there is no libjvm.so for runtime:
```
Exception in thread "main" java.lang.UnsatisfiedLinkError: /<snip>/jianglizhou/github/
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:321)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:187)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:129)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:249)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:241)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2278)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.base/java.lang.System.loadLibrary(System.java:1663)
at ExplicitAttach.<clinit>(ExplicitAttach.java:60)
----------System.err:(31/2299)----------
```
This is similar to
- relates to
-
JDK-8349178 runtime/jni/atExit/TestAtExit.java should be supported on static JDK
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/527489c0
-
Review(master) openjdk/jdk/23500