RFR: JDK-8163102: Fix headless only configuration option

Erik Joelsson erik.joelsson at oracle.com
Thu Aug 4 08:24:23 UTC 2016


Hello,

New webrev: http://cr.openjdk.java.net/~erikj/8163102/webrev.02

The difference is in libraries.m4, where there was still a reference to 
SUPPORT_HEADFUL. I tried building a headless configuration without X11 
configured, but it unfortunately failed. libawt.so still requires X11 
headers to compile. I suppose we could differentiate between headers and 
libs being available, but I will leave that for another time.

On 2016-08-03 22:37, David Holmes wrote:
> Hi Erik,
>
> The confusion around that variable due to its legacy always makes me 
> worried that something is misunderstood. It was originally to deal 
> with a build platform that had no headful support (no X11 libs and 
> headers etc) and so could not build headful no matter what. The flag 
> but not the functionality was carried into the new build system. What 
> you have now is a different beast entirely.
>
Right, but unfortunately it still requires X11 headers as said above, 
and tracing through history, this must always have been true for a long 
time.
>> In this patch I'm replacing the configure option with
>> --enable-headless-only. Default is disabled, where both headless and GUI
>> support is built. When enabled, only headless support is built. These
>> are the two variants we are ever interested in.
>>
>> On the makefile side, I redefined the variable as
>> ENABLE_HEADLESS_ONLY=true/false.
>
> This all seems reasonable. Though of course you have to ensure that a 
> headless build can still execute all the necessary functionality. Even 
> for headless some of the AWT API's still have to be available 
> (printing support for one IIRC).
As far as I can see, this should be fine, but perhaps someone from 
2d/awt should comment. This is what --enable-headless-only removes:

* policytool - a gui application which does not seem to have any 
functionality without a gui
* appletviewer - seems pointless without a gui
* libsplashscreen - seems pointless without a gui
* libawt_xawt - the X11 specific parts of awt that links to libX11
* A placeholder libjawt is built which just doesn't do anything

These are also exactly the libraries and executables that link to X11. 
Regardless of if we can use this option at Oracle, I believe it's a good 
fix for OpenJDK.

>
>> I also needed to change jawt.c to get a headless only build to actually
>> work. The requirement that -DJAVASE_EMBEDDED is set seems unnecessary
>> and unrelated to me.
>
> The JAVASE_EMBEDDED stuff has now all been removed, but that change 
> hasn't reached dev yet.
>
Right, and that change conflicts with mine since it also removed the 
possibility of building a "headless" libjawt. This means I should hold 
on this change until hs gets into dev.

/Erik



More information about the build-dev mailing list