When running test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/VThreadEventTest.java on static JDK, it fails due to missing libjvm.so:
```
TEST RESULT: Failed. Execution failed: `main' threw exception: com.sun.tools.attach.AgentLoadException: Failed to load agent library: VThreadEventTest was not loaded. libjvm.so: cannot open shared object file: No such file or directory
```
Looking at libVThreadEventTest.cpp, I think the only reason for explicitly linking with `libjvm.so` is the direct function call to `JNI_GetCreatedJavaVMs` from `Agent_OnAttach`. And there is no need to call `JNI_GetCreatedJavaVMs` since `Agent_OnAttach` already has the `vm` arg.
```
TEST RESULT: Failed. Execution failed: `main' threw exception: com.sun.tools.attach.AgentLoadException: Failed to load agent library: VThreadEventTest was not loaded. libjvm.so: cannot open shared object file: No such file or directory
```
Looking at libVThreadEventTest.cpp, I think the only reason for explicitly linking with `libjvm.so` is the direct function call to `JNI_GetCreatedJavaVMs` from `Agent_OnAttach`. And there is no need to call `JNI_GetCreatedJavaVMs` since `Agent_OnAttach` already has the `vm` arg.
- relates to
-
JDK-8303796 Optionally build fully statically linked JDK image
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/bb70896e
-
Review(master) openjdk/jdk/23835