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

Linux: libjvm.so should set soname

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 5.0
    • hotspot
    • beta2
    • generic, x86
    • linux

      Email from ###@###.###:

      ---------------------------------------
      Do you happen to know if it's possible to dlopen( libjvm.so )? I'm able to do so and get a reference to JNI_CreateJavaVM. But when I actually invoke JNI_CreateJavaVM I end up getting an error:

      -----
      Error occurred during initialization of VM
      Unable to load native library: libjvm.so: cannot open shared object file: No such file or directory
      -----

      This doesn't make sense to me since I already loaded the library. I straced it and I think it's libjava.so trying to open libjvm.so and for some reason it cannot find it.

      Does this sound at all familiar to you? Do you have any tips? If not, is there anyone on your team that might be able to help?

      I'm trying to make it so my app can launch without having the JVM directories in LD_LIBRARY_PATH.
      ---------------------------------------

      Bug 4976297 explained the root cause for this failure: library libjava.so
      has a dependency on libjvm.so, when libjava.so is loaded, the dynamic
      linker first searches existing libraries based on their sonames. Because
      currently we don't set soname when building libjvm.so, dynamic linker will
      think libjvm.so is not loaded even though it's already dlopen'ed by the
      user application, causing a runtime error if libjvm.so is not on
      LD_LIBRARY_PATH.

      This behavior forces users of JVM invocation API to set LD_LIBRARY_PATH,
      which can be quite complex (see Java launcher code for proof). When
      LD_LIBRARY_PATH is not properly set up, applications that us invocation
      API will behave differently on Solaris and Linux.

            hhuangsunw Hui Huang (Inactive)
            hhuangsunw Hui Huang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: