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

Resolve multiple definition of 'JNI_OnLoad_jsound' linking error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • client-libs
    • None

      Multiple definition of 'JNI_OnLoad_jsound' linker error is observed when partially linking (using '-r' linking option, e.g. see https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html) 'libjsound' natives. See JDK-8307858 comments for related information. The same linking error is also observable when statically linking with a libjsound.a created without partially linking.

      /usr/bin/ld: /.../github/JDK-8307858/build/linux-x86_64-server-release/support/native/java.desktop/libjsound/static/Platform.o: in function `JNI_OnLoad_jsound':
      Platform.c:(.text.JNI_OnLoad_jsound+0x0): multiple definition of `JNI_OnLoad_jsound'; /.../github/JDK-8307858/build/linux-x86_64-server-release/support/native/java.desktop/libjsound/static/PLATFORM_API_LinuxOS_ALSA_CommonUtils.o:PLATFORM_API_LinuxOS_ALSA_CommonUtils.c:(.text.JNI_OnLoad_jsound+0x0): first defined here
      collect2: error: ld returned 1 exit status

      The multiple definition of 'JNI_OnLoad_jsound' issue is because both src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c and src/java.desktop/share/native/libjsound/Platform.c have 'DEF_STATIC_JNI_OnLoad'.

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

              Created:
              Updated:
              Resolved: