参考:
MacOS 10.15编译openjdk8u详细过程_lizhengjava的博客-CSDN博客_macos 编译openjdk
Mac上编译OpenJDK过程记录 - 活在夢裡 - 博客园
安装JDK8
MAC下载安装JDK_柳鲲鹏-CSDN博客_mac下载jdk
安装brew
MAC正确简单安装brew_柳鲲鹏-CSDN博客
安装各种工具
需要什么安装什么,不需要可以不安装。有些安装跟老版本的xcode可能有冲突。
sudo xcode-select --install
brew install freetype
brew install mercurial
brew install ant
brew install ccache
brew install autoconf
brew install llvm
brew install binutils
gcc、g++
安装xcode
在应用商业中安装。
下载源码
# 经常失败 hg clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev/
建议早上下载github,非常快:
GitHub - AdoptOpenJDK/openjdk-jdk8u: JDK8u mirror from mercurial
修改脚本hotspot/make/bsd/makefiles/gcc.make
(无必要?)hotspot/make/bsd/makefiles/gcc.make注释:
# Compiler warnings are treated as errors # ifneq ($(COMPILER_WARNINGS_FATAL),false) # WARNINGS_ARE_ERRORS = -Werror # endif
clang: error: unknown argument: ‘-fpch-deps‘_柳鲲鹏-CSDN博客
修改脚本generate-configigure.sh
configure: The C compiler (located as /usr/bin/gcc) does not seem to be the required gcc compiler._柳鲲鹏-CSDN博客
error: invalid argument ‘-std=gnu++98‘ not allowed with ‘C‘_柳鲲鹏-CSDN博客
编译freetype
MAC编译freetype_柳鲲鹏-CSDN博客_freetype mac
编译
NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 export CFLAGS="-I$NEW_INCLUDE" export CXXFLAGS="-I$NEW_INCLUDE" NEW_LIB=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib export LDFLAGS="-L${NEW_LIB}" export LIBRARY_PATH=$NEW_LIB:$LIBRARY_PATH export COMPILER_WARNINGS_FATAL=false make clean chmod 777 configure ./configure \ --with-freetype=`pwd`/../freetype-2.10.2 make all
NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
export CFLAGS="-I$NEW_INCLUDE"
export CXXFLAGS="-I$NEW_INCLUDE"
NEW_LIB=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
export LDFLAGS="-L${NEW_LIB}"
export LIBRARY_PATH=$NEW_LIB:$LIBRARY_PATH
export COMPILER_WARNINGS_FATAL=false
make clean
chmod 777 configure
./configure \
--with-freetype=`pwd`/../freetype-2.10.2
make all
错误
MAC clang: error: include path for libstdc++ headers not found
MAC编译OpenJDK8:clang: error: include path for libstdc++ headers not found(独家解决办法)_柳鲲鹏-CSDN博客
error: ‘&&‘ within ‘||‘ [-Werror,-Wlogical-op-parentheses]/Users/tsit/tsjdk8-project/tsjdk8/hotspot/
MAC编译OpenJDK8:error: ‘&&‘ within ‘||‘ [-Werror,-Wlogical-op-parentheses]_柳鲲鹏-CSDN博客
clang: error: unknown argument: ‘-fpch-deps‘
MAC编译OpenJDK8:clang: error: unknown argument: ‘-fpch-deps‘_柳鲲鹏-CSDN博客
iostream file not found
MAC编译OpenJDK8:iostream file not found(独家解决办法)_柳鲲鹏-CSDN博客
ld: library not found for -lstdc++
MAC编译OpenJDK8:ld: library not found for -lstdc++(独家解决办法)_柳鲲鹏-CSDN博客