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

Resolve multiple definition of 'throwIOException' and friends when statically linking with JDK native libraries

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • security-libs
    • None
    • b20

      When statically link JDK native libraries and libjvm (see JDK-8303796 for more details), the linker reports failures due to multiple definitions of 'throwIOException' and friends, including:

      - throwByName
      - throwOutOfMemoryError
      - throwNullPointerException
      - throwIOException
      - throw_internal_error

      E.g. of linker errors:

      /.../lib/libj2pcsc.a(pcsc.o): in function `throwOutOfMemoryError':
      /.../src/java.smartcardio/share/native/libj2pcsc/pcsc.c:71: multiple definition of `throwOutOfMemoryError'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2gss.a(NativeUtil.o):/.../src/java.security.jgss/share/native/libj2gss/NativeUtil.c:464: first defined here
      /usr/bin/ld: /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pcsc.a(pcsc_md.o): in function `throwByName':
      /.../src/java.smartcardio/unix/native/libj2pcsc/pcsc_md.c:60: multiple definition of `throwByName'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2gss.a(NativeUtil.o):/.../src/java.security.jgss/share/native/libj2gss/NativeUtil.c:456: first defined here
      ...
      /usr/bin/ld: /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pkcs11.a(p11_util.o): in function `throwByName':
      /.../src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c:243: multiple definition of `throwByName'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2gss.a(NativeUtil.o):/.../src/java.security.jgss/share/native/libj2gss/NativeUtil.c:456: first defined here
      /usr/bin/ld: /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pkcs11.a(p11_util.o): in function `throwOutOfMemoryError':
      /usr/local/google/home/jianglizhou/github/jdk-makefiles-static/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c:254: multiple definition of `throwOutOfMemoryError'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2gss.a(NativeUtil.o):/.../src/java.security.jgss/share/native/libj2gss/NativeUtil.c:464: first defined here
      /usr/bin/ld: /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pkcs11.a(p11_util.o): in function `throwNullPointerException':
      /.../src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c:262: multiple definition of `throwNullPointerException'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pcsc.a(pcsc_md.o):/.../src/java.smartcardio/unix/native/libj2pcsc/pcsc_md.c:71: first defined here
      /usr/bin/ld: /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pkcs11.a(p11_util.o): in function `throwIOException':
      /.../src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c:270: multiple definition of `throwIOException'; /.../build/linux-x86_64-server-slowdebug/images/static-libs/lib/libj2pcsc.a(pcsc_md.o):/.../src/java.smartcardio/unix/native/libj2pcsc/pcsc_md.c:79: first defined here
      /usr/bin/ld: /.../images/static-libs/lib/libmanagement_ext.a(management_ext.o): in function `throw_internal_error':...

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

              Created:
              Updated:
              Resolved: