On Wed, 9 Dec 2020 01:26:08 GMT, Phil Race <p...@openjdk.org> wrote: >> No, we produce only one image. The headless/non-headless mode is defined by >> the system property `-Djava.awt.headless=...`. >> Here is a command example for native image generation: >> `$ ~/graalvm-ce-java11-21.0.0-dev/bin/native-image >> -H:ConfigurationFileDirectories=./configs -Djava.awt.headless=true >> AWTFixExample` >> >> With `-Djava.awt.headless=false` to the gcc linker we pass `libawt.a` and >> `libawt_headless.a` >> With `-Djava.awt.headless=true` to the gcc linker we pass `libawt.a` and >> `libawt-xawt.a` >> If the generated image demands `libmlib_image.a` it will be also linked. > >> No, we produce only one image. The headless/non-headless mode is defined by >> the system property `-Djava.awt.headless=...`. >> Here is a command example for native image generation: >> `$ ~/graalvm-ce-java11-21.0.0-dev/bin/native-image >> -H:ConfigurationFileDirectories=./configs -Djava.awt.headless=true >> AWTFixExample` >> >> With `-Djava.awt.headless=false` to the gcc linker we pass `libawt.a` and >> `libawt_headless.a` >> With `-Djava.awt.headless=true` to the gcc linker we pass `libawt.a` and >> `libawt-xawt.a` >> If the generated image demands `libmlib_image.a` it will be also linked. > > -Djava.awt.headless is a runtime property not a build time property. So you > are doing domething very weird. > How does that image with "false" run a UI app ? It can't. And yet the one > with "true" still can run without an xserver, except it will not start unless > you have X11 libs installed - and I am *reasonably* sure you aren't > statically linking all the system provided libraries ... I hope ... > > So how does a "user" use all of this ? Seems they must create their own app > by native compile + linking. > Can they create an image that can run any java app, or must the app like > AWTFixExample be linked in to the image ?
@prrace It may be also useful to look at how we define a set of static libraries: https://github.com/oracle/graal/blob/9390324021ab7b6ed391f2c8f62be490a7ab13db/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationAwt.java#L104 ------------- PR: https://git.openjdk.java.net/jdk/pull/562