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

jextract crashes with lapacke.h on Mac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • repo-panama
    • tools
    • x86
    • os_x

      Attempting to jextract lapacke.h (of LAPACK library) on Mac results in crash.

      $ jextract \
        -L /usr/local/opt/lapack/lib -I /usr/local/opt/lapack/ \
        -l lapacke -t lapack -infer-rpath /usr/local/opt/lapack/include/lapacke.h -o clapack.jar


      stack trace:


      Exception in thread "main" java.lang.IllegalArgumentException
      at java.base/jdk.internal.org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:242)
      at java.base/jdk.internal.org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1170)
      at java.base/jdk.internal.org.objectweb.asm.AnnotationWriter.visit(AnnotationWriter.java:155)
      at jdk.jextract/com.sun.tools.jextract.AsmCodeFactory.generateNativeHeader(AsmCodeFactory.java:125)
      at jdk.jextract/com.sun.tools.jextract.AsmCodeFactory.produce(AsmCodeFactory.java:585)
      at jdk.jextract/com.sun.tools.jextract.AsmCodeFactoryExt.produce(AsmCodeFactoryExt.java:143)
      at jdk.jextract/com.sun.tools.jextract.AsmCodeFactory.collect(AsmCodeFactory.java:595)
      at jdk.jextract/com.sun.tools.jextract.Context.writeJar(Context.java:525)
      at jdk.jextract/com.sun.tools.jextract.Context.lambda$collectJarFile$39(Context.java:554)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
      at jdk.jextract/com.sun.tools.jextract.Context.collectJarFile(Context.java:554)
      at jdk.jextract/com.sun.tools.jextract.Context.collectJarFile(Context.java:570)
      at jdk.jextract/com.sun.tools.jextract.Main.run(Main.java:306)
      at jdk.jextract/com.sun.tools.jextract.Main.main(Main.java:325)

      From ASM code:

          /**
           * Puts an UTF8 string into this byte vector. The byte vector is
           * automatically enlarged if necessary.
           *
           * @param s
           * a String whose UTF8 encoded length must be less than 65536.
           * @return this byte vector.
           */
          public ByteVector putUTF8(final String s) {
              int charLength = s.length();
              if (charLength > 65535) {
                  throw new IllegalArgumentException();
              }

      It seems that jextract is trying to add huge UTF to constant pool. I suspect most likely it is the header annotation's declarations string.

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: