8255790: GTKL&F: Java 16 crashes on initialising GTKL&F on Manjaro Linux

Reviewed-by: serb, ihse, azvegint
This commit is contained in:
Phil Race 2021-03-16 19:36:04 +00:00
parent 422eba81b1
commit 05fe06a6ba
2 changed files with 41 additions and 85 deletions

View File

@ -432,92 +432,49 @@ endif
###########################################################################
ifeq ($(USE_EXTERNAL_HARFBUZZ), true)
LIBHARFBUZZ_LIBS := $(HARFBUZZ_LIBS)
LIBFONTMANAGER_EXTRA_SRC =
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBHARFBUZZ_LIBS)
else
LIBFONTMANAGER_EXTRA_SRC = libharfbuzz
# This is better than adding EXPORT_ALL_SYMBOLS
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
HARFBUZZ_CFLAGS += -DHB_EXTERN=__attribute__\(\(visibility\(\"default\"\)\)\)
else ifeq ($(TOOLCHAIN_TYPE), microsoft)
HARFBUZZ_CFLAGS += -DHB_EXTERN=__declspec\(dllexport\)
endif
ifeq ($(call isTargetOs, windows), false)
HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
-DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
endif
ifeq ($(call isTargetOs, linux macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
endif
ifeq ($(call isTargetOs, macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
endif
ifeq ($(call isTargetOs, windows), false)
HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
-DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
endif
ifeq ($(call isTargetOs, linux macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
endif
ifeq ($(call isTargetOs, macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
endif
ifeq ($(call isTargetOs, macosx), false)
LIBHARFBUZZ_EXCLUDE_FILES += libharfbuzz/hb-coretext.cc
endif
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
LIBHARFBUZZ_EXCLUDE_FILES += libharfbuzz/hb-ft.cc
# Early re-canonizing has to be disabled to workaround an internal XlC compiler error
# when building libharfbuzz
ifeq ($(call isTargetOs, aix), true)
HARFBUZZ_CFLAGS += -qdebug=necan
endif
LIBHARFBUZZ_CFLAGS += $(HARFBUZZ_CFLAGS)
ifeq ($(call isTargetOs, macosx), false)
LIBFONTMANAGER_EXCLUDE_FILES += libharfbuzz/hb-coretext.cc
endif
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
LIBFONTMANAGER_EXCLUDE_FILES += libharfbuzz/hb-ft.cc
# For use by libfontmanager:
ifeq ($(call isTargetOs, windows), true)
LIBHARFBUZZ_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libharfbuzz/harfbuzz.lib
else
LIBHARFBUZZ_LIBS := -lharfbuzz
endif
LIBHARFBUZZ_EXTRA_HEADER_DIRS := \
libharfbuzz/hb-ucdn \
#
LIBHARFBUZZ_OPTIMIZATION := HIGH
# Early re-canonizing has to be disabled to workaround an internal XlC compiler error
# when building libharfbuzz
ifeq ($(call isTargetOs, aix), true)
LIBHARFBUZZ_CFLAGS += -qdebug=necan
endif
LIBHARFBUZZ_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
$(eval $(call SetupJdkLibrary, BUILD_LIBHARFBUZZ, \
NAME := harfbuzz, \
EXCLUDE_FILES := $(LIBHARFBUZZ_EXCLUDE_FILES), \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
OPTIMIZATION := $(LIBHARFBUZZ_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBHARFBUZZ_EXTRA_HEADER_DIRS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := type-limits missing-field-initializers strict-aliasing, \
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
maybe-uninitialized class-memaccess, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
HARFBUZZ_DISABLED_WARNINGS_gcc := type-limits missing-field-initializers strict-aliasing
HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
maybe-uninitialized class-memaccess
HARFBUZZ_DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast \
undef missing-field-initializers range-loop-analysis, \
DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_aix := -Wl$(COMMA)-berok, \
LIBS := $(BUILD_LIBHARFBUZZ), \
LIBS_unix := $(LIBM) $(LIBCXX), \
LIBS_macosx := -framework CoreText -framework CoreFoundation -framework CoreGraphics, \
LIBS_windows := user32.lib, \
))
undef missing-field-initializers range-loop-analysis
HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138
ifeq ($(FREETYPE_TO_USE), bundled)
$(BUILD_LIBHARFBUZZ): $(BUILD_LIBFREETYPE)
endif
TARGETS += $(BUILD_LIBHARFBUZZ)
LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
endif
###########################################################################
LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libharfbuzz \
@ -528,10 +485,10 @@ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libawt/java2d/loops \
#
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS) $(HARFBUZZ_FLAGS)
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBHARFBUZZ_LIBS) $(LIBFREETYPE_LIBS)
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
LIBFONTMANAGER_OPTIMIZATION := HIGH
LIBFONTMANAGER_OPTIMIZATION := HIGHEST
ifeq ($(call isTargetOs, windows), true)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
@ -569,7 +526,12 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
EXTRA_SRC := $(LIBFONTMANAGER_EXTRA_SRC), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := $(HARFBUZZ_DISABLED_WARNINGS_gcc), \
DISABLED_WARNINGS_CXX_gcc := $(HARFBUZZ_DISABLED_WARNINGS_CXX_gcc), \
DISABLED_WARNINGS_clang := $(HARFBUZZ_DISABLED_WARNINGS_clang), \
DISABLED_WARNINGS_microsoft := $(HARFBUZZ_DISABLED_WARNINGS_microsoft), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
$(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@ -577,17 +539,13 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
LDFLAGS_aix := -Wl$(COMMA)-berok, \
LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
LIBS_macosx := -lawt_lwawt, \
LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation -framework CoreGraphics, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
$(WIN_AWT_LIB), \
))
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
ifeq ($(USE_EXTERNAL_HARFBUZZ), false)
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBHARFBUZZ)
endif
ifeq ($(call isTargetOs, macosx), true)
$(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt)
endif

View File

@ -53,8 +53,6 @@ public class FontManagerNativeLibrary {
NB: consider moving freetype wrapper part to separate
shared library in order to avoid dependency. */
System.loadLibrary("freetype");
/* Same for harfbuzz */
System.loadLibrary("harfbuzz");
}
System.loadLibrary("fontmanager");