几天前在32位ubuntu14下编译了openjdk7u40,又试着在64位CentOS7下编译了openjdk7u60。
这次是按照官方发布的编译说明(README-builds.html)进行的。
先安装好ant、cups等信赖,然后获取源码:
hg clone http://hg.openjdk.java.net/jdk7/jdk7 YourOpenJDK
cd YourOpenJDK
sh ./get_source.sh
这次直接使用Oracle JDK,编译脚本类似。
********************************************************
export LANG=C
export ALT_BOOTDIR=/usr/java/jdk1.6.0_45
export ALLOW_DOWNLOADS=true
export HOTSPOT_BUILD_JOBS=4
export ALT_PARALLEL_COMPILE_JOBS=4
export SKIP_COMPARE_IMAGES=true
export USE_PRECOMPILED_HEADER=true
export BUILD_LANGTOOLS=true
#export BUILD_JAXP=false
#export BUILD_JAXWS=false
#export BUILD_CORBA=false
export BUILD_HOTSPOT=true
export BUILD_JDK=true
BUILD_DEPLOY=false
BUILD_INSTALL=false
unset JAVA_HOME
unset CLASSPATH
#make sanity
make 2>&1 | tee build.log
********************************************************
这次遇到了一些新的问题:
1.
/usr/bin/ld: cannot find -lstdc++
ln: accessing `libjvm.so.1': Too many levels of symbolic links
网上有人说应该用32位的libstdc++,而且README-builds.html也给出了提示:
- Error Message: libstdc++ not found:
This is caused by a missing libstdc++.a library. This is installed as part of a specific package (e.g. libstdc++.so.devel.386). By default some 64-bit Linux versions (e.g. Fedora) only install the 64-bit version of the libstdc++ package. Various parts of the JDK build require a static link of the C++ runtime libraries to allow for maximum portability of the built images.
原来是stdc++版本的问题:
It is the "static-devel" package that is required by OpenJDK.
2.
fatal error: X11/extensions/XTest.h: No such file or directory
解决方法:yum install libXtst-devel