You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 进入根目录
cd jdk8u
// 设置环境变量
./setEnv.sh
// 执行 bash ./configure
./build.sh
// 编译
make all
执行 bash configure 报错
需要 Xcode 4
运行 bash ./configure 报错:
checking for xcodebuild... /usr/bin/xcodebuild
configure: error: Xcode 4 is required to build JDK 8, the version found was 9.3. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select.
解决办法: vi ./common/autoconf/generated-configure.sh
然后,注释掉 19369 行附近代码段中 if block 包含代码
# Fail-fast: verify we're building on Xcode 4, we cannot build with Xcode 5 or later
XCODE_VERSION=`$XCODEBUILD -version | grep '^Xcode ' | sed 's/Xcode //'`
XC_VERSION_PARTS=( ${XCODE_VERSION//./ } )
#if test ! "${XC_VERSION_PARTS[0]}" = "4"; then
#as_fn_error $? "Xcode 4 is required to build JDK 8, the version found was $XCODE_VERSION. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select." "$LINENO" 5
#fi
需要 GCC 编译器
configure: error: GCC compiler is required. Try setting --with-tools-dir.
解决办法:
先找到报错文件行数
$ grep -rn "GCC compiler is required." ./common/autoconf
./common/autoconf/toolchain.m4:129: AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
./common/autoconf/generated-configure.sh:20398: #as_fn_error $? "GCC compiler is required. Try setting --with-tools-dir." "$LINENO" 5
./common/autoconf/generated-configure.sh:22000: #as_fn_error $? "GCC compiler is required. Try setting --with-tools-dir." "$LINENO" 5
打开文件 vi ./common/autoconf/generated-configure.sh 然后注释掉即可
make 编译报错
cpp 文件报错
/Users/shenxing/Development/Projects/Java/OpenJdk/jdk8u/hotspot/src/share/vm/opto/lcm.cpp:52:35: error: ordered comparison between pointer and zero ('address' (aka 'unsigned char *') and 'int')
if (Universe::narrow_oop_base() > 0) { // Implies UseCompressedOops.
/Users/shenxing/Development/Projects/Java/OpenJdk/jdk8u/hotspot/src/share/vm/opto/loopPredicate.cpp:872:73: error: ordered comparison between pointer and zero ('const TypeInt *' and 'int')
assert(rng->Opcode() == Op_LoadRange || _igvn.type(rng)->is_int() >= 0, "must be");
/Users/shenxing/Development/Projects/Java/OpenJdk/jdk8u/hotspot/src/share/vm/runtime/virtualspace.cpp:345:14: error: ordered comparison between pointer and zero ('char *' and 'int')
if (base() > 0) {
解决办法:
vi ./hotspot/src/share/vm/opto/lcm.cpp
vi ./hotspot/src/share/vm/opto/loopPredicate.cpp
vi ./hotspot/src/share/vm/runtime/virtualspace.cpp
> 0 改为 != NULL
configure 配置问题
error: invalid argument '-std=gnu++98' not allowed with 'C'
解决办法:
vi common/autoconf/generated-configure.sh
case $COMPILER_NAME in
gcc )
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
-pipe \
-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
CXXSTD_CXXFLAG="-std=gnu++98"
注释掉 CXXSTD_CXXFLAG="-std=gnu++98" 这一行
找不到 x86_64 符号
Undefined symbols for architecture x86_64:
"_attachCurrentThread", referenced from:
+[ThreadUtilities getJNIEnv] in ThreadUtilities.o
+[ThreadUtilities getJNIEnvUncached] in ThreadUtilities.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
下载代码
根据 jdk8u 中
Source code
中的提示准备工作
构建环境变量脚本
然后复制以下文本,最后记得执行
:x
保存退出然后
chmod 755 setEnv.sh
,执行的时候直接使用./setEnv.sh
即可必须使用 JDK7
详情请查看
README-builds.html
中的解释安装 freetype
不需要安装 ccache
请看这里的解释
构建执行 configure 的脚本
然后复制以下文本:
执行脚本
执行 bash configure 报错
需要 Xcode 4
运行
bash ./configure
报错:解决办法:
vi ./common/autoconf/generated-configure.sh
然后,注释掉 19369 行附近代码段中 if block 包含代码
需要 GCC 编译器
解决办法:
先找到报错文件行数
打开文件
vi ./common/autoconf/generated-configure.sh
然后注释掉即可make 编译报错
cpp 文件报错
解决办法:
> 0
改为!= NULL
configure 配置问题
解决办法:
vi common/autoconf/generated-configure.sh
注释掉
CXXSTD_CXXFLAG="-std=gnu++98"
这一行找不到 x86_64 符号
解决办法:
vi ./jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m
然后把
inline void attachCurrentThread(void** env) {
改为
static inline void attachCurrentThread(void** env) {
Reference
mac 10.13.x编译openjdk8
Mac 编译 OpenJDK 7
The text was updated successfully, but these errors were encountered: