[OpenJDK 2D-Dev] RFR: JDK-8196218: [linux] libfontmanager should be linked against headless awt library
erik.joelsson at oracle.com
Fri Jan 26 16:54:31 UTC 2018
On 2018-01-26 08:44, Phil Race wrote:
> When this was fixed for Solaris
> the observed problem was not building (although it could have been)
> but at runtime.
> I think you can verify what you've done with "ldd" ..
> This patch adds awt_headless.so, but does not remove awt.so.
> Perhaps the line
> LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX)
> After your fix I expect "ldd" should not need to show awt .. just
> ie linux should not have this -lawt dependency any more and the -lawt
> dependency should be specific to windows + mac ..
So we already use -lawt_headless on solaris and aix, then I really can't
see a reason not to do the same for linux.
> On 01/26/2018 08:10 AM, Severin Gehwolf wrote:
>> Could I please get a review for this rather small patch which
>> originally occurred for us on JDK 8 (Fedora) which recently switched to
>> building with "-Wl,-z,defs" linker flags. The result was a build
>> failure, due to unresolved symbols. Indeed libfontmanager.so should
>> have -lawt_headless in the list of dependent libs as symbols such as
>> AWTLoadFont come from libawt_headless.so, not libawt.so on Linux. Some
>> more details are on the bug.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8196218
>> Testing: Build fails with configure option
>> --with-extra-ldflags="-Xlinker -z -Xlinker defs"
>> prior the fix. Succeeds after.
>> Question for 2d-folks/build-dev folks:
> I don't know about this, build folks probably know.
This is from way ahead of my time. The filtering is simply the
build-infra way of achieving the same thing as in the old build system.
Here is the corresponding code in jdk7:
$ hg annotate make/sun/font/Makefile
0: # Created without -z defs on linux
0: ifeq ($(PLATFORM), linux)
0: LDFLAGS_DEFS_OPTION =
>> There is this snippet in the libfontmanager block in
>> make/lib/Awt2dLibraries.gmk, line 686:
>> LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))
>> $(LDFLAGS_CXX_JDK) \
>> $(call SET_SHARED_LIBRARY_ORIGIN), \
>> It's my understanding that this is supposed to filter "-Wl,-z,defs"
>> from LDFLAGS_JDKLIB. Does anybody know why it does so? Is there a legit
>> reason when unresolved symbols at link time are OK? Besides, why does
>> it not also filter "-Xlinker -z -Xlinker defs"? FWIW, in JDK 8 it's the
>> other way round. Xlinker flags are filtered, but -Wl,-z,defs is not.
More information about the build-dev