今天试着编译jdk1.7。make sanity都check passed了,可是在make时,就发生这个错误:
make[2]: Entering directory '/home/fengli/Downloads/MyOpenJdk7/langtools/make'
JAVA_HOME=/usr/lib/jdk1.6.0_32 ANT_OPTS=-Djava.io.tmpdir='/home/fengli/Downloads/MyOpenJdk7/build/langtools/build/ant-tmp' /usr/lib/apache-ant-1.10.3/bin/ant -Djdk.version=1.7.0 -Dfull.version='1.7.0-internal-root_2018_11_06_19_55-b00' -Dmilestone=internal -Dbuild.number=b00 -Djavac.target=7 -Djavac.source=7 -Dboot.java.home=/usr/lib/jdk1.6.0_32 -Dimport.jdk=/home/fengli/Downloads/MyOpenJdk7/jdk -Dbuild.dir=/home/fengli/Downloads/MyOpenJdk7/build/langtools/build -Ddist.dir=/home/fengli/Downloads/MyOpenJdk7/build/langtools/dist build
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
Makefile:201: recipe for target 'build' failed
make[2]: *** [build] Error 1
make[2]: Leaving directory '/home/fengli/Downloads/MyOpenJdk7/langtools/make'
make/langtools-rules.gmk:37: recipe for target 'langtools-build' failed
make[1]: *** [langtools-build] Error 2
make[1]: Leaving directory '/home/fengli/Downloads/MyOpenJdk7'
Makefile:244: recipe for target 'build_product_image' failed
make: *** [build_product_image] Error 2
我/etc/profile是这样的:
/etc/profile: system-wide .profile file for the Bourne shell (sh(1))
and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "id -u
" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
jdk1.8
#export JAVA_HOME=/usr/lib/jdk1.8.0_191
#export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
#export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
jdk1.7
#export JAVA_HOME=/usr/lib/jdk1.7.0_80
#export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
#export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
jdk1.6
export JAVA_HOME=/usr/lib/jdk1.6.0_32
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
#set Ant enviroment
export ANT_HOME=/usr/lib/apache-ant-1.10.3
export PATH=$PATH:$ANT_HOME/bin
for jdk7 compile
export LANG=C
#BootStrap-JDK
export ALT_BOOTDIR=/usr/lib/jdk1.6.0_32
#OracleJDK
export ALT_JDK_IMPORT_PATH=/usr/lib/jdk1.6.0_32
#
export ALLOW_DOWNLOADS=true
#the same with you cup cores
export HOTSPOT_BUILD_JOBS=2
export ALT_PARALLEL_COMPILE_JOBS=2
#
export USE_PRECOMPILED_HEADER=true
#
export BUILD_LANGTOOLS=true
export BUILD_JAXWS=false
#export BUILD_JAXP=false
#export BUILD_CORBA=false
export BUILD_HOTSPOT=true
export BUILD_JDK=true
export SKIP_COMPARE_IMAGES=true
#
BUILD_DEPLOY=false
#
BUILD_INSTALL=false
#
export ALT_OUTPUTDIR=/home/fengli/Downloads/MyOpenJdk7/build
#
unset JAVA_HOME
unset CLASSPATH
#
make 2>&1 | tee $ALT_OUTPUTDIR/build.log