Ubuntu22 编译openjdk12
下载openjdk12源码
下载openjdk11作为BootJDK
执行configure
bash ./configure --with-boot-jdk=/home/zhoupeng/jdk-11.0.2 --with-target-bits=64 --enable-debug --with-native-debug-symbols=internal --with-freetype-include=/usr/include/freetype2 --with-freetype-lib=/usr/lib/x86_64-linux-gnu --disable-ccache --disable-warnings-as-errors --with-extra-cflags='-fcommon'
或者
bash configure --with-boot-jdk=/home/zhoupeng/jdk-11.0.2 --with-debug-level=slowdebug --with-native-debug-symbols=internal --enable-dtrace --with-toolchain-type=clang --disable-warnings-as-errors --with-extra-cflags='-fcommon'
执行make all
make all
成功截图:
可能出现的错误
/usr/bin/ld: ..........multiple definition of `parentPathv'
解决方案:configure中添加--with-extra-cflags='-fcommon'
见bug提交:https://bugs.openjdk.org/browse/JDK-8235903
/usr/include/limits.h:144:5: error: function-like macro ‘__GLIBC_USE‘ is not defined
解决方案:编辑 sudo vim /usr/include/limits.h
添加如下内容
/* The integer width macros are not defined by GCC's <limits.h> before
GCC 7, or if _GNU_SOURCE rather than
__STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature. */
#ifdef __GLIBC_USE
#else
#define __GLIBC_USE(F) __GLIBC_USE_ ## F
#endif
Building target 'all' in configuration 'linux-x86_64-server-fastdebug'
解决方案:修改 make/common/MakeBase.gmk 为如下
# Param 2 - (optional) name of file to store value in
DependOnVariableHelper = \
$(strip \
$(eval $1_filename := $(call DependOnVariableFileName, $1, $2)) \
$(if $(wildcard $($1_filename)), $(eval include $($1_filename))) \
$(if $(call equals, $(strip $($1)), $(strip $($1_old))),,\
$(call MakeDir, $(dir $($1_filename))) \
$(if $(findstring $(LOG_LEVEL), trace), \
$(info NewVariable $1: >$(strip $($1))<) \
$(info OldVariable $1: >$(strip $($1_old))<)) \
$(call WriteFile, $1_old:=$(call DoubleDollar,$(call EscapeHash,$($1))), \
$($1_filename))) \
$($1_filename) \
)
见bug提交:https://github.com/openjdk/panama-foreign/commit/af5c725b
SIGSEGV:invalid address
在lldb中输入
pro hand -p true -s false SIGSEGV SIGBUS
本文来自博客园,作者:margo,转载请注明原文链接:https://www.cnblogs.com/ZMargo/articles/17846489.html