graal
graal copied to clipboard
Undefined reference to `XTestGrabControl'
Describe the issue
When I try to create a native image of a Swing app, I get this error:
/usr/bin/ld: org.jajuk.main.o: warning: relocation in read-only section `.svm_heap'
/usr/bin/ld: /home/bflorat/prog/graalvm-ce-java11-22.3.0-dev/lib/static/linux-amd64/glibc/libawt_xawt.a(awt_Robot.o): in function `Java_sun_awt_X11_XRobotPeer_setup':
awt_Robot.c:(.text.Java_sun_awt_X11_XRobotPeer_setup+0x1fd): undefined reference to `XTestQueryExtension'
/usr/bin/ld: awt_Robot.c:(.text.Java_sun_awt_X11_XRobotPeer_setup+0x222): undefined reference to `XTestGrabControl'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:204)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
...
Steps to reproduce the issue
- Create native-images manifests using
java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -Xms30M -Xmx2G -Djava.library.path=lib -cp jajuk.jar:lib/* org.jajuk.Main
and integrate META-INF/native-image directory into the jajuk.jar file.
- Try to create the native-image using :
 native-image -Djava.awt.headless=false --no-fallback -H:+ReportExceptionStackTraces --verbose -cp "jajuk.jar:lib/*" org.jajuk.Main
Describe GraalVM and your environment:
java --version && native-image --version && uname -a
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment GraalVM CE 22.3.0-dev (build 11.0.16+7-jvmci-22.3-b02)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0-dev (build 11.0.16+7-jvmci-22.3-b02, mixed mode, sharing)
GraalVM 22.3.0-dev Java 11 CE (Java Version 11.0.16+7-jvmci-22.3-b02)
Linux desk1 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Note: Ubuntu 22.04 (uses Wayland) Graalvm dev version of today (2022/07/23)
More details
Full logs:
native-image.log
Full META-INF/native-image directory: META-INF.zip
Hi, Thank you for reporting this, is it possible to share a reproducer code example for this?
Sorry, I have currently no access to my coding environment. You may use this linux distribution: https://github.com/jajuk-team/jajuk/releases/download/11.0/jajuk-linux-11.0.tar.gz
that include the app and all dependencies (without the auto configuration META-INF/native-image in this version). Tell me it's enough for you, otherwise i'll be able to provide more details in mid-august.
Note also that i managed to create a working hello world swing app native image using exactly the same configuration so the problem may come ftom dependencies...
Hi. Please tell me if you have enough inputs. I'll be glad to provide any additional information you may require to fix this.
I wasn't able to get the same error as you mentioned, I'll share the steps I took, maybe I missed something:
1. Untar the jajuk distribution you provided.
2. java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -Xms30M -Xmx2G -Djava.library.path=lib -cp "jajuk.jar:lib/*" org.jajuk.Main
3. native-image -Djava.awt.headless=false --no-fallback -H:+ReportExceptionStackTraces --verbose -cp "jajuk.jar:lib/*" org.jajuk.Main
Am I missing something?
As usual, I used OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 11.0.15+10-jvmci-22.1-b06) with exactly your commands and it worked !
I can't figure out the problem as I used exactly the same options but with the MANIFEST/native-image from the jajuk.jar file.
However, when I run the produced executable, I get this :
 ./org.jajuk.main
java.awt.AWTError: Toolkit not found: sun.awt.X11.XToolkit
at java.awt.Toolkit$2.run(Toolkit.java:595)
at java.awt.Toolkit$2.run(Toolkit.java:583)
at java.security.AccessController.executePrivileged(AccessController.java:169)
at java.security.AccessController.doPrivileged(AccessController.java:83)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1494)
at java.awt.EventQueue.invokeLater(EventQueue.java:1312)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1421)
at org.jajuk.Main.main(Main.java:89)
[ERROR] 106 / null
java.awt.AWTError: Toolkit not found: sun.awt.X11.XToolkit
at java.awt.Toolkit$2.run(Toolkit.java:595)
at java.awt.Toolkit$2.run(Toolkit.java:583)
at java.security.AccessController.executePrivileged(AccessController.java:169)
at java.security.AccessController.doPrivileged(AccessController.java:83)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1494)
at java.awt.EventQueue.invokeLater(EventQueue.java:1312)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1421)
at org.jajuk.Main.main(Main.java:89)
[DEBUG] Exit with code: 1
any idea ?
I think this is the same issue as #4807 Since the original issue cannot be reproduced I'll close this issue, please leave a comment with your use case and reproducer on #4807 and we can follow this issue there. Thank you
It seems that Native Image doesn't support XTestGrabControl correctly at this point. Could you please share a minimal reproducer so that we can test this against our revised AWT support for Linux?
Sure:
- Download https://github.com/jajuk-team/jajuk/releases/download/11.0/jajuk-linux-11.0.tar.gz
- Unzip and replace the provided jajuk.jar file provided bellow as attachement. It contains the META-INF/native-messaging content created using the Graalvm linux java 11 agent.
- Launch (using graalvm linux java 11) :
native-image -Djava.awt.headless=false --no-fallback -H:+ReportExceptionStackTraces --verbose -cp "jajuk.jar:lib/*" org.jajuk.Main