Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8349284

Make libExplicitAttach work on static JDK

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • None
    • core-libs
    • None
    • b10

      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 to JDK-8349178.

            jiangli Jiangli Zhou
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: