Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement graphics for JAXB #12393

Closed
JiriOndrusek opened this issue Sep 29, 2020 · 37 comments · Fixed by #20850
Closed

Implement graphics for JAXB #12393

JiriOndrusek opened this issue Sep 29, 2020 · 37 comments · Fixed by #20850
Labels
kind/enhancement New feature or request
Milestone

Comments

@JiriOndrusek
Copy link
Contributor

Description
I've implemented camel-quarkus extension for FOP (https://github.com/apache/camel-quarkus/tree/master/extensions/fop2).

I ran into following error using native-image:

java.lang.UnsupportedOperationException: Not implemented yet for GraalVM native images
at sun.java2d.cmm.lcms.LCMS.getTagNative(LCMS.java:28)
at sun.java2d.cmm.lcms.LCMSProfile$TagCache.getTag(LCMSProfile.java:70)
at sun.java2d.cmm.lcms.LCMSProfile.getTag(LCMSProfile.java:51)
at sun.java2d.cmm.lcms.LCMS.getTagSize(LCMS.java:88)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1355)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1343)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1550)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:239)
at org.apache.camel.component.fop.FopProducer.transform(FopProducer.java:92)

I've issued bug for graal VM (oracle/graal#2850), but then I was corrected, that issue is not caused by graal VM but by quarkus.

Disabled feature could be seen here - https://github.com/quarkusio/quarkus/pull/3246/files#diff-0e389a06405b679615dee1750de18d4eR15

Would it be possible to implement this feature?

Steps to simulate the missing feature

You can use integration test in camel-quarkus fop extension - https://github.com/apache/camel-quarkus/blob/master/integration-tests/fop/src/test/java/org/apache/camel/quarkus/component/fop/it/FopTest.java
To make test fail with the reported UnsupportdOperationException, you have to change value in substitution to false (https://github.com/apache/camel-quarkus/blob/master/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java#L29)

@gastaldi
Copy link
Contributor

Removing the substitution isn't enough. The code would still fail with an error like:

Caused by: java.lang.IllegalArgumentException: Can't load standard profile: sRGB.pf
	at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:942)
	at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:936)
	at java.security.AccessController.doPrivileged(AccessController.java:83)
	at java.awt.color.ICC_Profile.getStandardProfile(ICC_Profile.java:935)
	at java.awt.color.ICC_Profile.getDeferredInstance(ICC_Profile.java:1067)
	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:854)

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Sep 30, 2020

@gastaldi I didn't try to remove the substitution. I can try to poke into it, to see whether it is possible to make this work ith camel-quarkus extension.

I thought, that to fix this, there would be more work (not only to remove substitution).
Would it make any sense to just remove the substitution (if it could work)?

@gastaldi
Copy link
Contributor

@JiriOndrusek removing the substitution is only the tip of the iceberg AFAIK.
I am not sure GraalVM supports the java.awt classes TBH.

Maybe a solution is to add substitutions in FOP to not depend on Java2D processing instead.

@JiriOndrusek
Copy link
Contributor Author

@gastaldi Yeas I agree that this is a working solution (see https://github.com/apache/camel-quarkus/blob/master/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java#L29)

But I was wondering if this "not implemented" part of quarkus will be implemented in future (and I wanted to show interest for this missing feature)

@gastaldi
Copy link
Contributor

If GraalVM supports the Java 2D classes I don't see why it wouldn't. I think it all depends on that

@JiriOndrusek
Copy link
Contributor Author

@gastaldi I've found this document: https://www.graalvm.org/reference-manual/r/JavaInteroperability/#java-graphics-interoperability

From my PoV it seems, that graalVM supports awt. (mainly the second paragraph)
But TBH this goes beyond my understanding of quarkus/grallVM limitations ...

Is there anything I could do, to "move" this issue closer to making it work?

@gastaldi
Copy link
Contributor

I found that same document too yesterday, but then realized it talks about the R language support :)

It says that:

The graphics package and most of its functions are not supported at the moment

So I am not sure what we could do besides having a Substitution class for the parts where the Java2D Graphics API is required

@sherl0cks
Copy link
Contributor

Graal 21.0.0 now support AWT and ImageIO oracle/graal#1163 and https://www.graalvm.org/release-notes/21_0/. These are issues I've been tracking for a long time. Is there any way to disable the current quarkus substitution until quarkus has a fix?

@gsmet
Copy link
Member

gsmet commented Jan 21, 2021

/cc @zakkak for the 21 upgrade

@zakkak
Copy link
Contributor

zakkak commented Jan 22, 2021

Could someone please point me to a reproducer?

We should probably add an integration test for this as well.
Simply reverting ef87e55 doesn't trigger any failures in the existing test suite (see https://github.com/zakkak/quarkus/actions/runs/502266148)

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Jan 22, 2021

@zakkak there is no special reproducer created for this issue.

Simulation could be done by execution of test https://github.com/apache/camel-quarkus/tree/master/integration-tests/fop

  1. first change value in https://github.com/apache/camel-quarkus/blob/master/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java#L29 to false
  2. run test via mvn clean verify -Pnative -f integration-tests/fop/

@zakkak
Copy link
Contributor

zakkak commented Jan 22, 2021

@JiriOndrusek I am not able to reproduce with:

git clone https://github.com/apache/camel-quarkus 
cd camel-quarkus
sed -i 's/true/false/g' extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java
./mvnw clean install -Dquickly -T4
./mvnw clean verify -Pnative -f integration-tests/fop/
./mvnw clean verify -Pnative -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:21.0-java11 -f integration-tests/fop/

@JiriOndrusek
Copy link
Contributor Author

@zakkak I'll verify it on Monday and let you know

@sherl0cks
Copy link
Contributor

Bumping this issue. If you'd like a reproducer that's not from the camel project, the original graal issue on ImageIO should work - it also has lots of other context oracle/graal#1163

@zakkak
Copy link
Contributor

zakkak commented Jan 27, 2021

Bumping this issue. If you'd like a reproducer that's not from the camel project, the original graal issue on ImageIO should work - it also has lots of other context oracle/graal#1163

I am looking for something resulting in the exception mentioned in the description of this issue so that I could try to remove the substitution and trace the issue through Quarkus. AFAIK the reproducer in oracle/graal#1163 is working with GraalVM 21.0 so I want to see what's needed on the Quarkus side.

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Jan 27, 2021

@zakkak I'm sorry for the delay.
Here is my result:

  • I built camel-quarkus from revision 19765046e64b5f39ee6b8aeaed27b3514986b2c3 (apache/camel-quarkus@1976504) - using mvn clean install -DskipTests
  • I've used graal graalvm-ce-java11-21.1.0
  • I've edited integration-tests/fop/src/test/java/org/apache/camel/quarkus/component/fop/it/Fop/FopTest.java and change value in substitution to false l29
  • I've enabled test by removing Disabled annotation in integration-tests/fop/src/test/java/org/apache/camel/quarkus/component/fop/it/FopIT.java l22

After execution I can see an error (executed as mvn clean verify -Pnative -f integration-tests/fop/):

Caused by: java.lang.UnsupportedOperationException: Not implemented yet for GraalVM native images
at sun.java2d.cmm.lcms.LCMS.getTagNative(LCMS.java:28)
at sun.java2d.cmm.lcms.LCMSProfile$TagCache.getTag(LCMSProfile.java:70)
at sun.java2d.cmm.lcms.LCMSProfile.getTag(LCMSProfile.java:51)
at sun.java2d.cmm.lcms.LCMS.getTagSize(LCMS.java:88)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1355)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1343)

@sherl0cks
Copy link
Contributor

Bumping this issue. If you'd like a reproducer that's not from the camel project, the original graal issue on ImageIO should work - it also has lots of other context oracle/graal#1163

I am looking for something resulting in the exception mentioned in the description of this issue so that I could try to remove the substitution and trace the issue through Quarkus. AFAIK the reproducer in oracle/graal#1163 is working with GraalVM 21.0 so I want to see what's needed on the Quarkus side.

Apologies I was not more clear @zakkak - you can wrap that example in any quarkus executable extension like Resteasy and it will reproduce if you build native because the substitute is in quarkus core. Sound like @JiriOndrusek has something you can run now, but if youd' like another example, let me know.

@zakkak
Copy link
Contributor

zakkak commented Feb 1, 2021

Thanks @JiriOndrusek

Removing the LCMS Substitutions and running with GraalVM CE 20.1 results in http://paste.debian.net/plain/1183561 which AFAICS is not triggered by the graphics part of the test (or some exception/error gets hidden).

Note that I am not getting the exception reported here

@sherl0cks
Copy link
Contributor

@zakkak This issue seems to have stalled out. Should I open a new with a specific reproducer just for quarkus core? Are you open a PR just removing the substitution? I really would like to use quarkus native with ImageIO and this seems like the last hurdle in this very long journey.

@zakkak
Copy link
Contributor

zakkak commented Feb 18, 2021

@sherl0cks a minimal reproducer would probably help. However, keep in mind that ImageIO appears to be causing some issues (see #14972 for more details), so it is not yet clear how to proceed with it.

@sherl0cks
Copy link
Contributor

@zakkak in the context of my issue, I don't see #14972 to be problematic. That issue seems to be an image size thing i.e. lets not include all these native libraries if we don't have to in order to keep native images smaller. Am I missing something? I'll try to get you a minimal reproducer ASAP.

@zakkak
Copy link
Contributor

zakkak commented Feb 19, 2021

That issue seems to be an image size thing i.e. lets not include all these native libraries if we don't have to in order to keep native images smaller. Am I missing something?

Apart from the image size, the linking with the graph libraries has also caused some regressions in Mandrel. We are still investigating how to make ImageIO/AWT support an opt-in feature and handle it properly.

Your reproducer might help in bringing in some initial support before polishing out the opt in part, but that's not my call to make :)

@sherl0cks
Copy link
Contributor

Simple project from https://code.quarkus.io/ with Resteasy https://github.com/sherl0cks/quarkus-imageio-reproducer

@zakkak ok this was very odd. I got it to work!?!? I need to go test quarkus 1.11.3 in my production app now, but at least this reproducer shows a working example. I left comments about one issue which I think is just my limited knowledge of graal. Perhaps you can point me in the right direction?

https://github.com/sherl0cks/quarkus-imageio-reproducer/blob/master/src/main/java/org/acme/GreetingResource.java#L18-L25

@sherl0cks
Copy link
Contributor

@zakkak I was able to reproduce my original issue. It appears that the substitution is not a problem for jpg or png, but it is for tiff. Commit pushed with a new test that should make this clear.

@zakkak
Copy link
Contributor

zakkak commented Feb 22, 2021

@zakkak ok this was very odd. I got it to work!?!?

By you got it to work you mean that you got it compile right?

When I run org.acme.NativeGreetingResourceIT.testFailJpgEndpoint I get:

2021-02-22 16:19:57,800 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /imageio/fail/jpg failed, error id: bb17e47e-2374-4b28-9e95-ab17c014bd39-1: org.jboss.resteasy.spi.UnhandledException: java.lang.UnsupportedOperationException: Not implemented yet for GraalVM native images
        at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
        at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:519)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
        at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
        at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:138)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:41)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.lang.UnsupportedOperationException: Not implemented yet for GraalVM native images
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:15)
        at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1181)
        at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1170)
        at org.acme.GreetingResource.hello(GreetingResource.java:27)
        at java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
        at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:643)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:507)
        at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:457)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:459)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:419)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:393)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:492)
        ... 17 more

I left comments about one issue which I think is just my limited knowledge of graal. Perhaps you can point me in the right direction?

If I understand correctly the issue is that you don't know how to generate the proper configuration for your Quarkus app to make it work with ImageIO. Unfortunately this is not yet implemented (see #13567) and you would need to run the steps manually to get it to work. However, the exception I posted above indicates that this is not a configuration issue (yet), Quarkus first needs to remove some substitutions to get ImageIO to work.

@zakkak I was able to reproduce my original issue. It appears that the substitution is not a problem for jpg or png, but it is for tiff. Commit pushed with a new test that should make this clear.

Nice, it looks like the jpg issue got fixed by oracle/graal#3032 and we need a similar patch for com.sun.imageio.plugins.tiff.

@sherl0cks
Copy link
Contributor

I think you got it. To summarize, I have 3 test cases that cover the current state of native / imageio:

@zakkak
Copy link
Contributor

zakkak commented Feb 22, 2021

Well I first applied the following diff to get rid of the exception I mentioned earlier:

diff --git a/quarkus-logo.jpg b/quarkus-logo.jpg
index 637dd33..e69de29 100644
Binary files a/quarkus-logo.jpg and b/quarkus-logo.jpg differ
diff --git a/src/main/java/org/acme/GreetingResource.java b/src/main/java/org/acme/GreetingResource.java
index 2871e6f..242431f 100644
--- a/src/main/java/org/acme/GreetingResource.java
+++ b/src/main/java/org/acme/GreetingResource.java
@@ -24,10 +24,10 @@ public class GreetingResource {
     @Produces(MediaType.TEXT_PLAIN)
     public String hello() throws IOException {
         BufferedImage bufferedImage = ImageIO.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("quarkus-logo.png"));
-        Graphics graphics = bufferedImage.getGraphics();
-        graphics.setColor(Color.MAGENTA);
-        graphics.drawString("test", 100, 100);
-        graphics.dispose();
+        // Graphics graphics = bufferedImage.getGraphics();
+        // graphics.setColor(Color.MAGENTA);
+        // graphics.drawString("test", 100, 100);
+        // graphics.dispose();
         File newFile = new File("quarkus-logo.jpg");
         ImageIO.write(bufferedImage, "jpg", newFile);
         BufferedImage bufferedImage2 = ImageIO.read(newFile);
@@ -59,4 +59,4 @@ public class GreetingResource {
     }
 
 
-}
\ No newline at end of file
+}

Then I:

  1. Run ./mvnw verify -Pnative once to build the source-jar (soon we will have an option to do this without building the native image, see Add native-source package type #15233)
  2. export GRAALVM_HOME=/opt/jvms/graalvm-ce-java11-21.0.0
  3. cd target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar
  4. Run mkdir -p META-INF/native-image
  5. $GRAALVM_HOME/bin/java -agentlib:native-image-agent=config-output-dir=./META-INF/native-image -jar imageio-issue-1.0.0-SNAPSHOT-runner.jar
  6. Visit http://0.0.0.0:8080/imageio/fail/jpg and http://0.0.0.0:8080/imageio/fail/tiff
  7. Kill the process
  8. $GRAALVM_HOME/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 -H:ResourceConfigurationFiles=resources-config.json --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar imageio-issue-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace imageio-issue-1.0.0-SNAPSHOT-runner
  9. ./imageio-issue-1.0.0-SNAPSHOT-runner
  10. Visit http://0.0.0.0:8080/imageio/fail/jpg and that's were I get a segmentation fault

So to summarize, it looks like you won't be able to get it to work even if you apply the configuration steps manually.

@sherl0cks
Copy link
Contributor

Bummer. Thanks for testing.

@zakkak
Copy link
Contributor

zakkak commented Feb 22, 2021

* Read tiff fails and needs a graal patch like [oracle/graal#3032](https://github.com/oracle/graal/pull/3032). Should I open such a PR in graal?

Oh I forgot to reply to this. Yes, by all means :)

@sherl0cks
Copy link
Contributor

Looks easier said than done - was hoping it was a 1 liner but it looks like it needs a lot more than that. I will look closer.

@rsvoboda
Copy link
Member

rsvoboda commented Feb 26, 2021

UnsupportedOperationException: Not implemented yet for GraalVM native images is caused by Quarkus substitution
https://github.com/quarkusio/quarkus/blob/master/core/runtime/src/main/java/io/quarkus/runtime/graal/Java2DSubstitutions.java

I was playing again with https://github.com/rsvoboda/rsvoboda-playground/tree/master/jfreesvg/jfreesvg-quarkus and GraalVM 201.0 to see how graphics support works in this version.

I played with Quarkus master with removed Java2DSubstitutions.java and basically followed the flow that @zakkak described

mvn clean package -Dnative -DskipTests -Dquarkus-plugin.version=999-SNAPSHOT -Dquarkus.platform.version=999-SNAPSHOT
cd target/jfreesvg-quarkus-1.0-SNAPSHOT-native-image-source-jar/
mkdir -p META-INF/native-image

$GRAALVM_HOME/bin/java -agentlib:native-image-agent=config-output-dir=./META-INF/native-image -jar  jfreesvg-quarkus-1.0-SNAPSHOT-runner.jar
curl http://localhost:8080/ping

$GRAALVM_HOME/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar jfreesvg-quarkus-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace jfreesvg-quarkus-1.0-SNAPSHOT-runner

./jfreesvg-quarkus-1.0-SNAPSHOT-runner
curl http://localhost:8080/ping

And I received this error:

Caused by: java.lang.UnsatisfiedLinkError: sun.awt.image.BufImgSurfaceData.initRaster(Ljava/lang/Object;IIIIIILjava/awt/image/IndexColorModel;)V [symbol: Java_sun_awt_image_BufImgSurfaceData_initRaster or Java_sun_awt_image_BufImgSurfaceData_initRaster__Ljava_lang_Object_2IIIIIILjava_awt_image_IndexColorModel_2]
	at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:153)
	at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:57)
	at sun.awt.image.BufImgSurfaceData.initRaster(BufImgSurfaceData.java)
	at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:274)
	at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:92)
	at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:74)
	at sun.awt.image.BufImgSurfaceManager.<init>(BufImgSurfaceManager.java:55)
	at sun.awt.image.SurfaceManager.getManager(SurfaceManager.java:79)
	at sun.java2d.SurfaceData.getPrimarySurfaceData(SurfaceData.java:274)
	at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:184)
	at sun.java2d.HeadlessGraphicsEnvironment.createGraphics(HeadlessGraphicsEnvironment.java:70)
	at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1182)
	at org.jfree.graphics2d.svg.SVGGraphics2D.getFontMetrics(SVGGraphics2D.java:1658)
	at java.awt.Graphics.getFontMetrics(Graphics.java:257)
	at org.jfree.chart.text.G2TextMeasurer.getStringWidth(G2TextMeasurer.java:63)
	at org.jfree.chart.text.TextUtils.nextLineBreak(TextUtils.java:227)
	at org.jfree.chart.text.TextUtils.createTextBlock(TextUtils.java:168)
	at org.jfree.chart.title.TextTitle.arrangeRR(TextTitle.java:628)
	at org.jfree.chart.title.TextTitle.arrange(TextTitle.java:496)
	at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1370)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1260)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1160)
	at cz.rsvoboda.PingResource.ping(PingResource.java:48)

Did some search across oracle/graal issues and awt related work doesn't seem to be the priority.

@sherl0cks
Copy link
Contributor

sherl0cks commented Mar 3, 2021

@zakkak I just added a new commit to my reproducer that leads to the below link error during the build. Wonder if this is instructive?

  1. Build quarkus locally with substitution removed. Update reproducer to use 999-SNAPSHOT
  2. java -agentlib:native-image-agent=config-output-dir= src/main/resources/META-INF/native-image -jar target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner.jar
  3. Hit fail/tiff and fail/jpg and fail/tiff2
  4. Exit native image config process
  5. ./mvnw clean package -P native leads to below fail.
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /opt/graalvm/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:ResourceConfigurationFiles=resources-config.json --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar imageio-issue-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace imageio-issue-1.0.0-SNAPSHOT-runner
[imageio-issue-1.0.0-SNAPSHOT-runner:301]    classlist:   9,165.86 ms,  0.96 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]        (cap):     715.96 ms,  0.94 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]        setup:   3,213.56 ms,  0.94 GB
00:08:41,373 INFO  [org.jbo.threads] JBoss Threads version 3.2.0.Final
[imageio-issue-1.0.0-SNAPSHOT-runner:301]     (clinit):     766.42 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]   (typeflow):  16,931.10 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]    (objects):  18,185.71 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]   (features):   1,127.79 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]     analysis:  38,364.27 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]     universe:   1,525.78 ms,  2.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]      (parse):   6,452.45 ms,  2.53 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]     (inline):   5,522.24 ms,  3.03 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]    (compile):  43,415.19 ms,  3.07 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]      compile:  57,842.22 ms,  3.09 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]        image:   5,091.11 ms,  3.07 GB
[imageio-issue-1.0.0-SNAPSHOT-runner:301]        write:   5,892.16 ms,  3.07 GB
Fatal error:java.lang.RuntimeException: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-8482669544485080230/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner imageio-issue-1.0.0-SNAPSHOT-runner.o /opt/graalvm/lib/static/linux-amd64/glibc/libnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libjavajpeg.a /opt/graalvm/lib/static/linux-amd64/glibc/libextnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libnio.a /opt/graalvm/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/graalvm/lib/static/linux-amd64/glibc/libjava.a /opt/graalvm/lib/static/linux-amd64/glibc/liblcms.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt_headless.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt.a /opt/graalvm/lib/static/linux-amd64/glibc/libfdlibm.a /opt/graalvm/lib/static/linux-amd64/glibc/libzip.a /opt/graalvm/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-8482669544485080230 -L/opt/graalvm/lib/static/linux-amd64/glibc -L/opt/graalvm/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lpthread -ldl -lz -lrt -no-pie 

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner' '-v' '-L/tmp/SVM-8482669544485080230' '-L/opt/graalvm/lib/static/linux-amd64/glibc' '-L/opt/graalvm/lib/svm/clibraries/linux-amd64' '-no-pie' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccrza6Vh.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner -z noexecstack /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/tmp/SVM-8482669544485080230 -L/opt/graalvm/lib/static/linux-amd64/glibc -L/opt/graalvm/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. --gc-sections --dynamic-list /tmp/SVM-8482669544485080230/exported_symbols.list --exclude-libs ALL -x imageio-issue-1.0.0-SNAPSHOT-runner.o /opt/graalvm/lib/static/linux-amd64/glibc/libnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libjavajpeg.a /opt/graalvm/lib/static/linux-amd64/glibc/libextnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libnio.a /opt/graalvm/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/graalvm/lib/static/linux-amd64/glibc/libjava.a /opt/graalvm/lib/static/linux-amd64/glibc/liblcms.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt_headless.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt.a /opt/graalvm/lib/static/linux-amd64/glibc/libfdlibm.a /opt/graalvm/lib/static/linux-amd64/glibc/libzip.a /opt/graalvm/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lpthread -ldl -lz -lrt -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0x50): undefined reference to `Java_sun_java2d_loops_DrawGlyphListLCD_DrawGlyphListLCD'
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0x798): undefined reference to `Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA'
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0xf80): undefined reference to `Java_sun_java2d_loops_DrawGlyphList_DrawGlyphList'
collect2: error: ld returned 1 exit status
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600)
        at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:370)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:529)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:561)
Caused by: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-8482669544485080230/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner imageio-issue-1.0.0-SNAPSHOT-runner.o /opt/graalvm/lib/static/linux-amd64/glibc/libnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libjavajpeg.a /opt/graalvm/lib/static/linux-amd64/glibc/libextnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libnio.a /opt/graalvm/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/graalvm/lib/static/linux-amd64/glibc/libjava.a /opt/graalvm/lib/static/linux-amd64/glibc/liblcms.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt_headless.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt.a /opt/graalvm/lib/static/linux-amd64/glibc/libfdlibm.a /opt/graalvm/lib/static/linux-amd64/glibc/libzip.a /opt/graalvm/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-8482669544485080230 -L/opt/graalvm/lib/static/linux-amd64/glibc -L/opt/graalvm/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lpthread -ldl -lz -lrt -no-pie 

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner' '-v' '-L/tmp/SVM-8482669544485080230' '-L/opt/graalvm/lib/static/linux-amd64/glibc' '-L/opt/graalvm/lib/svm/clibraries/linux-amd64' '-no-pie' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccrza6Vh.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /project/target/imageio-issue-1.0.0-SNAPSHOT-native-image-source-jar/imageio-issue-1.0.0-SNAPSHOT-runner -z noexecstack /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/tmp/SVM-8482669544485080230 -L/opt/graalvm/lib/static/linux-amd64/glibc -L/opt/graalvm/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. --gc-sections --dynamic-list /tmp/SVM-8482669544485080230/exported_symbols.list --exclude-libs ALL -x imageio-issue-1.0.0-SNAPSHOT-runner.o /opt/graalvm/lib/static/linux-amd64/glibc/libnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libjavajpeg.a /opt/graalvm/lib/static/linux-amd64/glibc/libextnet.a /opt/graalvm/lib/static/linux-amd64/glibc/libnio.a /opt/graalvm/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/graalvm/lib/static/linux-amd64/glibc/libjava.a /opt/graalvm/lib/static/linux-amd64/glibc/liblcms.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt_headless.a /opt/graalvm/lib/static/linux-amd64/glibc/libawt.a /opt/graalvm/lib/static/linux-amd64/glibc/libfdlibm.a /opt/graalvm/lib/static/linux-amd64/glibc/libzip.a /opt/graalvm/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lpthread -ldl -lz -lrt -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0x50): undefined reference to `Java_sun_java2d_loops_DrawGlyphListLCD_DrawGlyphListLCD'
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0x798): undefined reference to `Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA'
imageio-issue-1.0.0-SNAPSHOT-runner.o:(.data+0xf80): undefined reference to `Java_sun_java2d_loops_DrawGlyphList_DrawGlyphList'
collect2: error: ld returned 1 exit status
        at com.oracle.svm.hosted.image.NativeBootImageViaCC.handleLinkerFailure(NativeBootImageViaCC.java:474)
        at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:441)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:685)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:43 min
[INFO] Finished at: 2021-03-03T00:10:18Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (default) on project imageio-issue: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:208)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1

@zakkak
Copy link
Contributor

zakkak commented Mar 3, 2021

Hi @sherl0cks, I suspect this is an upstream GraalVM issue.
I would try to create a minimal Java application (not using Quarkus) that references Java_sun_java2d_loops_DrawGlyphList_DrawGlyphList and see if GraalVM CE 21.0 works with it or not.

@geoand
Copy link
Contributor

geoand commented Oct 8, 2021

Would the new AWT extension be useful in this case?

@zakkak
Copy link
Contributor

zakkak commented Oct 8, 2021

cc @galderz @Karm

@Karm
Copy link
Member

Karm commented Oct 8, 2021

@geoand The update to AWT extension I have in making as a part of #20565 already covers a lot, glyphs included. I will add this to the test suite.
The usage of JFreeChart itself might require a separate extension though.

@galderz
Copy link
Member

galderz commented Oct 18, 2021

The usage of JFreeChart itself might require a separate extension though.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants