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

[jdk22u, jdk21u] [arm32] linking with libjvm.so fails after JDK-8142362

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 21, 22
    • hotspot
    • arm
    • linux_ubuntu

      The issue was found on Ubuntu when building collectd with openjdk-21[1].

      Building the following example:
      ---
      #include <jni.h>

      int main(){
          JavaVM *jvm; /* denotes a Java VM */
          JNIEnv *env; /* pointer to native method interface */
          JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
          JavaVMOption* options = new JavaVMOption[1];
          options[0].optionString = "-Djava.class.path=/usr/lib/java";
          vm_args.version = JNI_VERSION_1_6;
          vm_args.nOptions = 1;
          vm_args.options = options;
          vm_args.ignoreUnrecognized = false;
          /* load and initialize a Java VM, return a JNI interface
           * pointer in env */
          JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
      }
      ---

      $g++ test.cpp -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -L/usr/lib/jvm/default-java/lib/server -ljvm
      ...
      fails with /usr/bin/ld: /usr/lib/jvm/default-java/lib/server/libjvm.so: undefined reference to `_Copy_conjoint_bytes'

      JDK-8142362 removed the implementation of _Copy_conjoint_bytes but left the symbol declaration in, causing the symbol to be undefined:
       96657: 00000000 0 FUNC GLOBAL DEFAULT UND _Copy_conjoint_bytes

      JDK-8017234 fixed the issue in master by removing the declaration.
      openjdk-22 and openjdk-21 are still affected.

      [1] https://bugs.launchpad.net/ubuntu/+source/collectd/+bug/2058966

            vpetko Vladimir Petko
            vpetko Vladimir Petko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: