Linking against libawt_headless is going to be a problem here.
A footnote in the description of the original bug https://bugs.openjdk.java.net/browse/JDK-8196218
> As it turns out libawt_headless.so exports the missing symbols, but libfontmanager.so's link command does not include -lawt_headless.
> libawt.so (the non-headless version) on the other hand doesn't have it:
Well there's a mistake in there. The non-headless (ie headful) equivalent is actually libawt_xawt.so
It does have the symbols - as well !
At runtime JDK determines dynamically if it wants to load libawt_headless.so or libawt_xawt.so
It then uses System.load() - and dlopen - to load the one it wants.
Having an 'ldd' dependency on headless, but trying to run headful, we end up with both libraries loaded.
We are then at the mercy of the vagaries of the runtime symbol resolution which gets used.
On Fedora 27 - where it can't be reproduced - the dlopened library seems to be
taking precedence. This is probably what Solaris has been doing all along too.
But on Ubuntu 16.04 and (someone else here confirmed) OEL 7 (similar to RHEL7) we
seem to be getting the one that was linked at build time.
So we need to leave the -Wl,z,defs line there .. and also not link against headless ..
and pass whatever additional flags will cause the Fedora linker to allow unresolved symbols.
An alternative would be a flag that requires that the symbols be resolved somehow
at build time, but does not write the name of the library that satisfied the dependencies
into the list of dependent libraries.
Of course that would only prove that the symbols are defined in one of the two libraries ..