欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

编译openjdk7  

程序员文章站 2022-04-04 22:49:20
...
我是用linux x64 6u45来作为BOOT_JDK,编译openjdk7,ant用的是1.9.4
build.sh脚本如下:

 

 sudo apt-get install libfreetype6-dev

 

注释openjdk/hotspot/make/linux/Makefile文件的以下内容,

check_os_version:
#ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
#       $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
#endif

 否则会报以下错误:

make[6]: Entering directory `/opt/openjdk/build-debug/hotspot/outputdir'
>&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
*** This OS is not supported: Linux ThinkPad-Edge-E431 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 

make sanity的时候,注意在 /etc/profile里配置ANT的bin目录

WARNING: LANG has been set to zh_CN.UTF-8, this can cause build failures. 
         Try setting LANG to 'C'. 
 
ERROR: Your CLASSPATH environment variable is set.  This will 
       most likely cause the build to fail.  Please unset it 
       and start your build again. 
 
ERROR: Your JAVA_HOME environment variable is set.  This will 
       most likely cause the build to fail.  Please unset it 
       and start your build again. 
 
Exiting because of the above error(s). 
 
make: *** [post-sanity] 错误 1
root@ThinkPad-Edge-E431:/opt/openjdk# unset JAVA_HOME 
root@ThinkPad-Edge-E431:/opt/openjdk# unset CLASSPATH
root@ThinkPad-Edge-E431:/opt/openjdk# make sanity

 

 后来又碰到问题 还没解决:

Note: Recompile with -Xlint:unchecked for details.
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/hasher.jar /opt/openjdk/build/../build-debug/btclasses/hasher_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/hasher \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/hasher.jar
=========================================================
BUILDTOOL:                hasher
PACKAGE:                  build.tools.hasher
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.hasher.Hasher
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/hasher.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/hasher_classes'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/jarreorder'
/bin/echo -e "Main-Class: build.tools.jarreorder.JarReorder" > /opt/openjdk/build/../build-debug/btclasses/jarreorder_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/jarreorder/JarReorder.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/jarreorder.jar /opt/openjdk/build/../build-debug/btclasses/jarreorder_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/jarreorder \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/jarreorder.jar
=========================================================
BUILDTOOL:                jarreorder
PACKAGE:                  build.tools.jarreorder
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.jarreorder.JarReorder
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/jarreorder.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/jarreorder'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/jarsplit'
/bin/echo -e "Main-Class: build.tools.jarsplit.JarSplit" > /opt/openjdk/build/../build-debug/btclasses/jarsplit_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/jarsplit/JarSplit.java
Note: ../../tools/src/build/tools/jarsplit/JarSplit.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/jarsplit.jar /opt/openjdk/build/../build-debug/btclasses/jarsplit_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/jarsplit \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/jarsplit.jar
=========================================================
BUILDTOOL:                jarsplit
PACKAGE:                  build.tools.jarsplit
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.jarsplit.JarSplit
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/jarsplit.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/jarsplit'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/javazic'
/bin/echo -e "Main-Class: build.tools.javazic.Main" > /opt/openjdk/build/../build-debug/btclasses/javazic_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/javazic/Main.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/javazic.jar /opt/openjdk/build/../build-debug/btclasses/javazic_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/javazic \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/javazic.jar
=========================================================
BUILDTOOL:                javazic
PACKAGE:                  build.tools.javazic
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.javazic.Main
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/javazic.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/javazic'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/jdwpgen'
/bin/echo -e "Main-Class: build.tools.jdwpgen.Main" > /opt/openjdk/build/../build-debug/btclasses/jdwpgen_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/jdwpgen/Main.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/jdwpgen.jar /opt/openjdk/build/../build-debug/btclasses/jdwpgen_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/jdwpgen \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/jdwpgen.jar
=========================================================
BUILDTOOL:                jdwpgen
PACKAGE:                  build.tools.jdwpgen
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.jdwpgen.Main
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/jdwpgen.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/jdwpgen'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/makeclasslist'
/bin/echo -e "Main-Class: build.tools.makeclasslist.MakeClasslist" > /opt/openjdk/build/../build-debug/btclasses/makeclasslist_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/makeclasslist/MakeClasslist.java
Note: ../../tools/src/build/tools/makeclasslist/MakeClasslist.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/makeclasslist.jar /opt/openjdk/build/../build-debug/btclasses/makeclasslist_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/makeclasslist \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/makeclasslist.jar
=========================================================
BUILDTOOL:                makeclasslist
PACKAGE:                  build.tools.makeclasslist
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.makeclasslist.MakeClasslist
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/makeclasslist.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/makeclasslist'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/strip_properties'
/bin/echo -e "Main-Class: build.tools.stripproperties.StripProperties" > /opt/openjdk/build/../build-debug/btclasses/stripproperties_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/stripproperties/StripProperties.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/stripproperties.jar /opt/openjdk/build/../build-debug/btclasses/stripproperties_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/stripproperties \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/stripproperties.jar
=========================================================
BUILDTOOL:                stripproperties
PACKAGE:                  build.tools.stripproperties
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.stripproperties.StripProperties
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/stripproperties.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/strip_properties'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/spp'
/bin/echo -e "Main-Class: build.tools.spp.Spp" > /opt/openjdk/build/../build-debug/btclasses/spp_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/spp/Spp.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/spp.jar /opt/openjdk/build/../build-debug/btclasses/spp_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/spp \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/spp.jar
=========================================================
BUILDTOOL:                spp
PACKAGE:                  build.tools.spp
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.spp.Spp
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/spp.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/spp'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/CharsetMapping'
/bin/echo -e "Main-Class: build.tools.charsetmapping.Main" > /opt/openjdk/build/../build-debug/btclasses/charsetmapping_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/charsetmapping/Main.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/charsetmapping.jar /opt/openjdk/build/../build-debug/btclasses/charsetmapping_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/charsetmapping \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/charsetmapping.jar
=========================================================
BUILDTOOL:                charsetmapping
PACKAGE:                  build.tools.charsetmapping
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.charsetmapping.Main
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/charsetmapping.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/CharsetMapping'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/tools/generate_nimbus'
/bin/mkdir -p /opt/openjdk/build/../build-debug/btclasses/build/tools/generatenimbus/resources
rm -f /opt/openjdk/build/../build-debug/btclasses/build/tools/generatenimbus/resources/Defaults.template /opt/openjdk/build/../build-debug/btclasses/build/tools/generatenimbus/resources/PainterImpl.template /opt/openjdk/build/../build-debug/btclasses/build/tools/generatenimbus/resources/StateImpl.template
/bin/cp ../../../src/share/classes/javax/swing/plaf/nimbus/Defaults.template ../../../src/share/classes/javax/swing/plaf/nimbus/PainterImpl.template ../../../src/share/classes/javax/swing/plaf/nimbus/StateImpl.template /opt/openjdk/build/../build-debug/btclasses/build/tools/generatenimbus/resources
/bin/echo -e "Main-Class: build.tools.generatenimbus.Generator" > /opt/openjdk/build/../build-debug/btclasses/generatenimbus_manifest.mf
/usr/local/jdk1.6/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true -d /opt/openjdk/build/../build-debug/btclasses \
	    -sourcepath ../../tools/src ../../tools/src/build/tools/generatenimbus/Generator.java ../../tools/src/build/tools/generatenimbus/ObjectFactory.java ../../tools/src/build/tools/generatenimbus/Paint.java ../../tools/src/build/tools/generatenimbus/SynthModel.java ../../tools/src/build/tools/generatenimbus/UIDefault.java ../../tools/src/build/tools/generatenimbus/UIStyle.java
/usr/local/jdk1.6/bin/jar cfm /opt/openjdk/build/../build-debug/btjars/generatenimbus.jar /opt/openjdk/build/../build-debug/btclasses/generatenimbus_manifest.mf \
	    -C /opt/openjdk/build/../build-debug/btclasses build/tools/generatenimbus \
	    -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m || rm -f /opt/openjdk/build/../build-debug/btjars/generatenimbus.jar
=========================================================
BUILDTOOL:                generatenimbus
PACKAGE:                  build.tools.generatenimbus
BUILDTOOL_SOURCE_ROOT:    ../../tools/src
BUILTTOOL_MAINCLASS:      build.tools.generatenimbus.Generator
BUILDTOOL_JAR_FILE:       /opt/openjdk/build/../build-debug/btjars/generatenimbus.jar
=========================================================
make[5]: Leaving directory `/opt/openjdk/jdk/make/tools/generate_nimbus'
Done Processing SUBDIRS: addjsum buildmetaindex commentchecker compile_font_config compile_properties dir_diff dtdbuilder generate_break_iterator GenerateCharacter generatecurrencydata hasher_classes jarreorder jarsplit javazic jdwpgen makeclasslist strip_properties spp CharsetMapping generate_nimbus     
make[4]: Leaving directory `/opt/openjdk/jdk/make/tools'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[4]: Entering directory `/opt/openjdk/jdk/make/java'
Begin Processing SUBDIRS: version jvm redist verify fdlibm java sun_nio jli main zip security math util text net nio jar jexec awt applet beans  management npt java_crw_demo java_hprof_demo logging instrument invoke sql rmi 
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/java/version'
/bin/mkdir -p /opt/openjdk/build/../build-debug/gensrc/sun/misc
rm -f /opt/openjdk/build/../build-debug/gensrc/sun/misc/Version.java
rm -f /opt/openjdk/build/../build-debug/gensrc/sun/misc/Version.java.temp
/bin/sed -e 's/@@launcher_name@@/openjdk/g' \
	    -e 's/@@java_version@@/1.7.0-internal-debug/g' \
	    -e 's/@@java_runtime_version@@/1.7.0-internal-debug-root_2017_10_22_12_28-b00/g' \
	    -e 's/@@java_runtime_name@@/OpenJDK Runtime Environment/g' \
	../../../src/share/classes/sun/misc/Version.java.template > /opt/openjdk/build/../build-debug/gensrc/sun/misc/Version.java.temp
make[5]: Leaving directory `/opt/openjdk/jdk/make/java/version'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/java/jvm'
/bin/mkdir -p /opt/openjdk/build/../build-debug/include
rm -f /opt/openjdk/build/../build-debug/include/jni.h
/bin/cp ../../../src/share/javavm/export/jni.h /opt/openjdk/build/../build-debug/include/jni.h
/bin/mkdir -p /opt/openjdk/build/../build-debug/include/linux
rm -f /opt/openjdk/build/../build-debug/include/linux/jni_md.h
/bin/cp ../../../src/solaris/javavm/export/jni_md.h /opt/openjdk/build/../build-debug/include/linux/jni_md.h
/bin/mkdir -p /opt/openjdk/build/../build-debug/include
rm -f /opt/openjdk/build/../build-debug/include/jvmti.h
/bin/cp ../../../src/share/javavm/export/jvmti.h /opt/openjdk/build/../build-debug/include/jvmti.h
/bin/mkdir -p /opt/openjdk/build/../build-debug/include
rm -f /opt/openjdk/build/../build-debug/include/jvmticmlr.h
/bin/cp ../../../src/share/javavm/export/jvmticmlr.h /opt/openjdk/build/../build-debug/include/jvmticmlr.h
/bin/mkdir -p /opt/openjdk/build/../build-debug/include
rm -f /opt/openjdk/build/../build-debug/include/classfile_constants.h
/bin/cp ../../../src/share/javavm/export/classfile_constants.h /opt/openjdk/build/../build-debug/include/classfile_constants.h
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64
rm -f /opt/openjdk/build/../build-debug/lib/amd64/jvm.cfg
/bin/cp ../../../src/solaris/bin/amd64/jvm.cfg /opt/openjdk/build/../build-debug/lib/amd64/jvm.cfg
make[5]: Leaving directory `/opt/openjdk/jdk/make/java/jvm'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/java/redist'
Begin Processing SUBDIRS:  fonts    sajdi
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[6]: Entering directory `/opt/openjdk/jdk/make/java/redist/fonts'
make[6]: Nothing to be done for `all'.
make[6]: Leaving directory `/opt/openjdk/jdk/make/java/redist/fonts'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[6]: Entering directory `/opt/openjdk/jdk/make/java/redist/sajdi'
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/sa-jdi.jar
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib
rm -f /opt/openjdk/build/../build-debug/lib/sa-jdi.jar
/bin/cp /opt/openjdk/build-debug/hotspot/import/lib/sa-jdi.jar /opt/openjdk/build/../build-debug/lib/sa-jdi.jar
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.so
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64
rm -f /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.so
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/libsaproc.so /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.so
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.diz
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64
rm -f /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.diz
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/libsaproc.diz /opt/openjdk/build/../build-debug/lib/amd64/libsaproc.diz
make[6]: Leaving directory `/opt/openjdk/jdk/make/java/redist/sajdi'
Done Processing SUBDIRS:  fonts    sajdi
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64/server
rm -f /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/server/libjvm.so /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
Checking for mapfile use in: /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
Library loads for: /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
	linux-vdso.so.1 =>  (0x00002b7a633ad000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00002b7a6482f000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b7a64b35000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b7a64d3a000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b7a64f58000)
	/lib64/ld-linux-x86-64.so.2 (0x000055919936c000)
RUNPATH for: /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.so
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/server/Xusage.txt
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64/server
rm -f /opt/openjdk/build/../build-debug/lib/amd64/server/Xusage.txt
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/server/Xusage.txt /opt/openjdk/build/../build-debug/lib/amd64/server/Xusage.txt
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.diz
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64/server
rm -f /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.diz
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/server/libjvm.diz /opt/openjdk/build/../build-debug/lib/amd64/server/libjvm.diz
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64
rm -f /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/libjsig.so /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
Checking for mapfile use in: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
INFO: File was not built with a mapfile: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
Library loads for: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
	linux-vdso.so.1 =>  (0x00007fff20b81000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002aac3decb000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002aac3e0cf000)
	/lib64/ld-linux-x86-64.so.2 (0x000055a6f9082000)
RUNPATH for: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.so
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
ASSEMBLY_IMPORT: /opt/openjdk/build/../build-debug/lib/amd64/libjsig.diz
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib/amd64
rm -f /opt/openjdk/build/../build-debug/lib/amd64/libjsig.diz
/bin/cp /opt/openjdk/build-debug/hotspot/import/jre/lib/amd64/libjsig.diz /opt/openjdk/build/../build-debug/lib/amd64/libjsig.diz
/bin/ln -s  ../libjsig.so /opt/openjdk/build/../build-debug/lib/amd64/server/libjsig.so
/bin/ln -s ../libjsig.debuginfo /opt/openjdk/build/../build-debug/lib/amd64/server/libjsig.debuginfo
( cd  /opt/openjdk/build/../build-debug/lib/amd64/server ; \
	 /usr/bin/zip -y libjsig.diz libjsig.debuginfo ; \
	 rm -f libjsig.debuginfo ; \
	)
  adding: libjsig.debuginfo (stored 0%)
/usr/local/jdk1.6/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m -jar /opt/openjdk/build/../build-debug/btjars/addjsum.jar \
	    ../../tools/sharing/classlist.linux /opt/openjdk/build/../build-debug/lib/classlist.temp
/bin/mv /opt/openjdk/build/../build-debug/lib/classlist.temp /opt/openjdk/build/../build-debug/lib/classlist
if [ "" = "" ] ; then /bin/mkdir -p /opt/openjdk/build/../build-debug/lib ; ( cd  /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64 && /bin/cp lib/orb.idl lib/ir.idl /opt/openjdk/build/../build-debug/lib ) ; fi 
/bin/sh: 1: cd: can't cd to /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64
make[5]: *** [/opt/openjdk/build/../build-debug/tmp/java/components_imported] Error 2
make[5]: Leaving directory `/opt/openjdk/jdk/make/java/redist'
make[4]: *** [all] Error 1
make[4]: Leaving directory `/opt/openjdk/jdk/make/java'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/openjdk/jdk/make'
make[2]: *** [jdk-build] Error 2
make[2]: Leaving directory `/opt/openjdk'
make[1]: *** [generic_debug_build] Error 2
make[1]: Leaving directory `/opt/openjdk'
make: *** [build_debug_image] Error 2

 

观察make santity的结果:

root@ThinkPad-Edge-E431:/opt/openjdk# make sanity
( cd  ./jdk/make && \
	  make sanity HOTSPOT_IMPORT_CHECK=false JDK_TOPDIR=/opt/openjdk/jdk JDK_MAKE_SHARED_DIR=/opt/openjdk/jdk/make/common/shared EXTERNALSANITYCONTROL=true SOURCE_LANGUAGE_VERSION=7 TARGET_CLASS_VERSION=7 MILESTONE=internal BUILD_NUMBER=b00 JDK_BUILD_NUMBER=b00 FULL_VERSION=1.7.0-internal-root_2017_10_22_13_49-b00 PREVIOUS_JDK_VERSION=1.6.0 JDK_VERSION=1.7.0 JDK_MKTG_VERSION=7 JDK_MAJOR_VERSION=1 JDK_MINOR_VERSION=7 JDK_MICRO_VERSION=0 PREVIOUS_MAJOR_VERSION=1 PREVIOUS_MINOR_VERSION=6 PREVIOUS_MICRO_VERSION=0 ARCH_DATA_MODEL=64 COOKED_BUILD_NUMBER=0 ANT_HOME="/usr/local/ant1.9.4" ALT_OUTPUTDIR=/opt/openjdk/build/linux-amd64 ALT_LANGTOOLS_DIST=/opt/openjdk/build/linux-amd64/langtools/dist ALT_CORBA_DIST=/opt/openjdk/build/linux-amd64/corba/dist ALT_JAXP_DIST=/opt/openjdk/build/linux-amd64/jaxp/dist ALT_JAXWS_DIST=/opt/openjdk/build/linux-amd64/jaxws/dist ALT_HOTSPOT_IMPORT_PATH=/opt/openjdk/build/linux-amd64/hotspot/import BUILD_HOTSPOT=true ; )
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
/bin/sh: 1: [: Illegal number: /bin/sh:
/bin/sh: 1: [: Illegal number: /bin/sh:
/bin/sh: 1: [: Illegal number: 1:
/bin/sh: 1: [: Illegal number: 1:
/bin/sh: 1: [: Illegal number: /NO_BOOTDIR/bin/java:
/bin/sh: 1: [: Illegal number: /NO_BOOTDIR/bin/java:
/bin/sh: 1: [: Illegal number: Error:
/bin/sh: 1: [: Illegal number: Error:
/bin/sh: 1: [: Illegal number: JAVA_HOME
/bin/sh: 1: [: Illegal number: JAVA_HOME
/bin/sh: 1: [: Illegal number: is
/bin/sh: 1: [: Illegal number: is
make[1]: 正在进入目录 `/opt/openjdk/jdk/make'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[1]:正在离开目录 `/opt/openjdk/jdk/make'

Build Machine Information:
   build machine = ThinkPad-Edge-E431

Build Directory Structure:
   CWD = /opt/openjdk
   TOPDIR = .
   LANGTOOLS_TOPDIR = ./langtools
   JAXP_TOPDIR = ./jaxp
   JAXWS_TOPDIR = ./jaxws
   CORBA_TOPDIR = ./corba
   HOTSPOT_TOPDIR = ./hotspot
   JDK_TOPDIR = ./jdk

Build Directives:
   BUILD_LANGTOOLS = true 
   BUILD_JAXP = true 
   BUILD_JAXWS = true 
   BUILD_CORBA = true 
   BUILD_HOTSPOT = true 
   BUILD_JDK    = true 
   DEBUG_CLASSFILES =  
   DEBUG_BINARIES =  

Hotspot Settings: 
      HOTSPOT_BUILD_JOBS  =  
      HOTSPOT_OUTPUTDIR   = /opt/openjdk/build/linux-amd64/hotspot/outputdir 
      HOTSPOT_EXPORT_PATH = /opt/openjdk/build/linux-amd64/hotspot/import 
 



Bootstrap Settings:
  BOOTDIR = /NO_BOOTDIR
    ALT_BOOTDIR = 
  BOOT_VER = /bin/sh: 1: /NO_BOOTDIR/bin/java: not found [requires at least 1.6]
  OUTPUTDIR = /opt/openjdk/build/linux-amd64
    ALT_OUTPUTDIR = /opt/openjdk/build/linux-amd64
  ABS_OUTPUTDIR = /opt/openjdk/build/linux-amd64
 
Build Tool Settings:
  SLASH_JAVA = /NOT-SET
    ALT_SLASH_JAVA = 
  VARIANT = OPT
  JDK_DEVTOOLS_DIR = /NOT-SET/devtools
    ALT_JDK_DEVTOOLS_DIR = 
  ANT_HOME = /usr/local/ant1.9.4
  UNIXCOMMAND_PATH = /bin/
    ALT_UNIXCOMMAND_PATH = 
  COMPILER_PATH = /usr/bin/
    ALT_COMPILER_PATH = 
  DEVTOOLS_PATH = /usr/bin/
    ALT_DEVTOOLS_PATH = 
  UNIXCCS_PATH = /usr/ccs/bin/
    ALT_UNIXCCS_PATH = 
  USRBIN_PATH = /usr/bin/
    ALT_USRBIN_PATH = 
  COMPILER_NAME = GCC4
  COMPILER_VERSION = GCC4
  CC_VER = 4.8 [requires at least 4.3.0]
  ZIP_VER = 3.0 [requires at least 2.2]
  UNZIP_VER = 6.00 [requires at least 5.12]
  ANT_VER = Error: JAVA_HOME is not defined correctly.   We cannot execute /NO_BOOTDIR/bin/java [requires at least 1.7.1]
  TEMPDIR = /opt/openjdk/build/linux-amd64/tmp
 
Build Directives:
  OPENJDK = true
  USE_HOTSPOT_INTERPRETER_MODE = 
  PEDANTIC = 
  DEV_ONLY = 
  NO_DOCS = 
  NO_IMAGES = 
  TOOLS_ONLY = 
  INSANE = 
  COMPILE_APPROACH = parallel
  PARALLEL_COMPILE_JOBS = 2
    ALT_PARALLEL_COMPILE_JOBS = 
  FASTDEBUG = 
  COMPILER_WARNINGS_FATAL = false
  COMPILER_WARNING_LEVEL = 
  SHOW_ALL_WARNINGS = 
  INCREMENTAL_BUILD = false
  CC_HIGHEST_OPT = 
  CC_HIGHER_OPT = 
  CC_LOWER_OPT = 
  CXXFLAGS =  -O2 -fPIC -DCC_NOEX -W -Wall  -Wno-unused -Wno-parentheses -fno-omit-frame-pointer -D_LITTLE_ENDIAN  
  CFLAGS =  -O2   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN  
  BOOT_JAVA_CMD = /NO_BOOTDIR/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m
  BOOT_JAVAC_CMD = /NO_BOOTDIR/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -encoding ascii -source 6 -target 6 -XDignore.symbol.file=true
  BOOT_JAR_CMD = /NO_BOOTDIR/bin/jar
  BOOT_JARSIGNER_CMD = /NO_BOOTDIR/bin/jarsigner
  JAVAC_CMD = /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/bin/javac  -J-XX:ThreadStackSize=1536 -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m  -source 7 -target 7 -encoding ascii -Xbootclasspath:/opt/openjdk/build/linux-amd64/classes 
  JAVAH_CMD = /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/bin/javah -bootclasspath /opt/openjdk/build/linux-amd64/classes
  JAVADOC_CMD = /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/bin/javadoc -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -bootclasspath /opt/openjdk/build/linux-amd64/classes
 
Build Platform Settings:
  USER = root
  PLATFORM = linux
  ARCH = amd64
  LIBARCH = amd64
  ARCH_FAMILY = amd64
  ARCH_DATA_MODEL = 64
  ARCHPROP = amd64
  ALSA_VERSION = 1.0.27.2
  OS_VERSION = 4.4.0-31-generic [requires at least 2.6]
  OS_VARIANT_NAME = Ubuntu
  OS_VARIANT_VERSION = 14.04
  MB_OF_MEMORY = 15618
 
GNU Make Settings:
  MAKE = make
  MAKE_VER = 3.81 [requires at least 3.81]
  MAKECMDGOALS = sanity
  MAKEFLAGS = w
  SHELL = /bin/sh
 
Target Build Versions:
  JDK_VERSION = 1.7.0
  MILESTONE = internal
  RELEASE = 1.7.0-internal
  FULL_VERSION = 1.7.0-internal-root_2017_10_22_13_49-b00
  BUILD_NUMBER = b00
 
External File/Binary Locations:
  USRJDKINSTANCES_PATH = /opt/java
  BUILD_JDK_IMPORT_PATH = /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries
    ALT_BUILD_JDK_IMPORT_PATH = 
  JDK_IMPORT_PATH = /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64
    ALT_JDK_IMPORT_PATH = 
  LANGTOOLS_DIST = 
    ALT_LANGTOOLS_DIST = /opt/openjdk/build/linux-amd64/langtools/dist
  CORBA_DIST = 
    ALT_CORBA_DIST = /opt/openjdk/build/linux-amd64/corba/dist
  JAXP_DIST = 
    ALT_JAXP_DIST = /opt/openjdk/build/linux-amd64/jaxp/dist
  JAXWS_DIST = 
    ALT_JAXWS_DIST = /opt/openjdk/build/linux-amd64/jaxws/dist
  HOTSPOT_DOCS_IMPORT_PATH = /NO_DOCS_DIR
    ALT_HOTSPOT_DOCS_IMPORT_PATH = 
  HOTSPOT_IMPORT_PATH = /opt/openjdk/build/linux-amd64/hotspot/import
    ALT_HOTSPOT_IMPORT_PATH = /opt/openjdk/build/linux-amd64/hotspot/import
  HOTSPOT_SERVER_PATH = /opt/openjdk/build/linux-amd64/hotspot/import/jre/lib/amd64/server
    ALT_HOTSPOT_SERVER_PATH = 
  CACERTS_FILE = ./../src/share/lib/security/cacerts
    ALT_CACERTS_FILE = 
  CUPS_HEADERS_PATH = /usr/include
    ALT_CUPS_HEADERS_PATH = 
 
OpenJDK-specific settings:
  FREETYPE_HEADERS_PATH = /usr/include
    ALT_FREETYPE_HEADERS_PATH = 
  FREETYPE_LIB_PATH = /usr/lib
    ALT_FREETYPE_LIB_PATH = 
 
Previous JDK Settings:
  PREVIOUS_RELEASE_PATH = 
    ALT_PREVIOUS_RELEASE_PATH = 
  PREVIOUS_JDK_VERSION = 1.6.0
    ALT_PREVIOUS_JDK_VERSION = 
  PREVIOUS_JDK_FILE = 
    ALT_PREVIOUS_JDK_FILE = 
  PREVIOUS_JRE_FILE = 
    ALT_PREVIOUS_JRE_FILE = 
  PREVIOUS_RELEASE_IMAGE = 
    ALT_PREVIOUS_RELEASE_IMAGE = 


WARNING: LANG has been set to zh_CN.UTF-8, this can cause build failures. 
         Try setting LANG to 'C'. 
 
Sanity check passed.

 发现有些环境变量的值中存在NOT-SET关键词

 

 对比这位兄弟写的build.sh

https://ayonel.me/index.php/2017/01/05/compile_openjdk/这位兄弟写的还不错

发现,自己这里少配了ALT_JDK_IMPORT_PATH这个环境变量,配上后,果然上述错误就没有了

 

但是又出现了一个新的错误:

省略。。。
j64_g/TimeZone_md.o    /opt/openjdk/build/../build-debug/tmp/java/java.lang/java/obj64_g/FileSystemPreferences.o   -L/opt/openjdk/build/../build-debug/lib/amd64/server -ljvm -lverify    -ldl -L/opt/openjdk/build/../build-debug/tmp/java/java.lang/java/obj64_g/../../../fdlibm/obj64_g -lfdlibm.amd64   -lc
Checking for mapfile use in: /opt/openjdk/build/../build-debug/lib/amd64/libjava.so
INFO: File was not built with a mapfile: /opt/openjdk/build/../build-debug/lib/amd64/libjava.so
Library loads for: /opt/openjdk/build/../build-debug/lib/amd64/libjava.so
	linux-vdso.so.1 =>  (0x00007ffe65aef000)
	libjvm.so => not found
	libverify.so => /opt/openjdk/build/../build-debug/lib/amd64/libverify.so (0x00002b39c5ce7000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b39c5efc000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b39c6100000)
	/lib64/ld-linux-x86-64.so.2 (0x000055f8102ad000)
	libjvm.so => not found
RUNPATH for: /opt/openjdk/build/../build-debug/lib/amd64/libjava.so
 0x0000000000000001 (NEEDED)             Shared library: [libjvm.so]
 0x0000000000000001 (NEEDED)             Shared library: [libverify.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib
rm -f /opt/openjdk/build/../build-debug/lib/content-types.properties
/bin/cp ../../../src/solaris/lib/content-types.properties /opt/openjdk/build/../build-debug/lib/content-types.properties
/bin/mkdir -p /opt/openjdk/build/../build-debug/lib
rm -f /opt/openjdk/build/../build-debug/lib/calendars.properties
/bin/cp ../../../src/share/lib/calendars.properties /opt/openjdk/build/../build-debug/lib/calendars.properties
rm -f /opt/openjdk/build/../build-debug/lib/currency.data
/usr/local/jdk1.6/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m -jar /opt/openjdk/build/../build-debug/btjars/generatecurrencydata.jar -o /opt/openjdk/build/../build-debug/lib/currency.data.temp \
		< ../../../src/share/classes/java/util/CurrencyData.properties
Error: time is more than 10 years from present: 1136059200000
java.lang.RuntimeException: time is more than 10 years from present: 1136059200000
	at build.tools.generatecurrencydata.GenerateCurrencyData.makeSpecialCaseEntry(GenerateCurrencyData.java:285)
	at build.tools.generatecurrencydata.GenerateCurrencyData.buildMainAndSpecialCaseTables(GenerateCurrencyData.java:225)
	at build.tools.generatecurrencydata.GenerateCurrencyData.main(GenerateCurrencyData.java:154)
make[5]: *** [/opt/openjdk/build/../build-debug/lib/currency.data] Error 1
make[5]: Leaving directory `/opt/openjdk/jdk/make/java/java'
make[4]: *** [all] Error 1
make[4]: Leaving directory `/opt/openjdk/jdk/make/java'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/openjdk/jdk/make'
make[2]: *** [jdk-build] Error 2
make[2]: Leaving directory `/opt/openjdk'
make[1]: *** [generic_debug_build] Error 2
make[1]: Leaving directory `/opt/openjdk'
make: *** [build_debug_image] Error 2

 看到关键语句:

src/share/classes/java/util/CurrencyData.properties
Error: time is more than 10 years from present: 1136059200000

解决办法:

修改CurrencyData.properties(路径:jdk/src/share/classes/java/util/CurrencyData.properties)

修改108行
AZ=AZM;2009-12-31-20-00-00;AZN
修改381行
MZ=MZM;2009-06-30-22-00-00;MZN
修改443行
RO=ROL;2009-06-30-21-00-00;RON
修改535行
TR=TRL;2009-12-31-22-00-00;TRY
修改561行
VE=VEB;2009-01-01-04-00-00;VEF

 时间的问题解决了,重新执行./build.sh又发现了一个错误

INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[7]: Entering directory `/opt/openjdk/jdk/make/launchers'
=========================================================
LAUNCHER:        policytool
MAIN_CLASS:      sun.security.tools.policytool.PolicyTool
ALL_ARGS:        -J-ms8m  sun.security.tools.policytool.PolicyTool 
=========================================================
/usr/bin/gcc  -g   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN   -DDEBUG -DLOGGING  -DARCH='"amd64"' -Damd64 -DLINUX -DRELEASE='"1.7.0-internal-debug"' -DFULL_VERSION='"1.7.0-internal-debug-root_2017_10_22_14_06-b00"' -DJDK_MAJOR_VERSION='"1"' -DJDK_MINOR_VERSION='"7"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/opt/openjdk/build/../build-debug/tmp/sun/launcher/policytool/CClassHeaders -I../../src/solaris/javavm/export -I../../src/share/javavm/export -I../../src/share/bin -I../../src/solaris/bin -I../../src/share/native/java/util/zip/zlib-1.1.3 -DMAIN_CLASS='"sun.security.tools.policytool.PolicyTool"' -DJAVA_ARGS='{ "-J-ms8m", "sun.security.tools.policytool.PolicyTool",  }' -DLAUNCHER_NAME='"openjdk"' -DPROGNAME='"policytool"'    -c -o /opt/openjdk/build/../build-debug/tmp/sun/launcher/policytool/obj64_g/main.o \
		-DRELEASE='"1.7.0-internal-debug"' -DFULL_VERSION='"1.7.0-internal-debug-root_2017_10_22_14_06-b00"' -DJDK_MAJOR_VERSION='"1"' -DJDK_MINOR_VERSION='"7"' ../../src/share/bin/main.c
Rebuilding /opt/openjdk/build/../build-debug/bin/policytool because of /opt/openjdk/build/../build-debug/tmp/sun/launcher/policytool/obj64_g/main.o
/usr/bin/gcc -o /opt/openjdk/build/../build-debug/bin/policytool -Xlinker -version-script=../java/main/java/mapfile-amd64  -Wl,--hash-style=both -Xlinker -z -Xlinker defs -L/opt/openjdk/build/../build-debug/lib/amd64 -Wl,-soname=lib.so  -L /opt/openjdk/build/../build-debug/lib/amd64/jli  -Wl,--allow-shlib-undefined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli \
	/opt/openjdk/build/../build-debug/tmp/sun/launcher/policytool/obj64_g/main.o -lpthread  -L/usr/X11R6//lib64 -lX11 -ljli  -ldl -lc
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
make[7]: *** [/opt/openjdk/build/../build-debug/bin/policytool] Error 1
make[7]: Leaving directory `/opt/openjdk/jdk/make/launchers'
make[6]: *** [build] Error 2
make[6]: Leaving directory `/opt/openjdk/jdk/make/sun/security/tools'
make[5]: *** [all] Error 1
make[5]: Leaving directory `/opt/openjdk/jdk/make/sun/security'
make[4]: *** [all] Error 1
make[4]: Leaving directory `/opt/openjdk/jdk/make/sun'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/openjdk/jdk/make'
make[2]: *** [jdk-build] Error 2
make[2]: Leaving directory `/opt/openjdk'
make[1]: *** [generic_debug_build] Error 2
make[1]: Leaving directory `/opt/openjdk'
make: *** [build_debug_image] Error 2

 

然后按照缺啥补啥的策略,安装以下库

apt-get install libX11-dev

 

继续报错:

/src/solaris/native/sun/awt/../java2d -I../../../src/share/native/sun/awt/../java2d/loops -I../../../src/share/native/sun/awt/../java2d/pipe -I../../../src/share/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/x11 -I../../../src/share/native/sun/awt/../dc/doe -I../../../src/share/native/sun/awt/../dc/path -I../../../src/solaris/native/sun/awt/../jdga -I../../../src/solaris/native/sun/awt   -c -o /opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/Region.o  ../../../src/share/native/sun/awt/../java2d/pipe/Region.c
/usr/bin/gcc  -g   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH  -DDEBUG -DLOGGING  -DARCH='"amd64"' -Damd64 -DLINUX -DRELEASE='"1.7.0-internal-debug"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/sun/awt -I../../../src/solaris/native/sun/awt   -I/usr/X11R6//include -I/usr/X11R6//include/X11/extensions -I../../../src/solaris/native/sun/awt/font  -I../../../src/share/native/sun/awt/debug -I../../../src/share/native/sun/awt/../font -I../../../src/solaris/native/sun/awt/../font -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/shell -I../../../src/share/native/sun/awt/medialib -I../../../src/solaris/native/sun/awt/medialib -I../../../src/share/native/sun/awt/../java2d -I../../../src/solaris/native/sun/awt/../java2d -I../../../src/share/native/sun/awt/../java2d/loops -I../../../src/share/native/sun/awt/../java2d/pipe -I../../../src/share/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/x11 -I../../../src/share/native/sun/awt/../dc/doe -I../../../src/share/native/sun/awt/../dc/path -I../../../src/solaris/native/sun/awt/../jdga -I../../../src/solaris/native/sun/awt   -c -o /opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/BufImgSurfaceData.o  ../../../src/share/native/sun/awt/image/BufImgSurfaceData.c
In file included from ../../../src/solaris/native/sun/awt/color.h:28:0,
                 from ../../../src/solaris/native/sun/awt/img_util_md.h:26,
                 from ../../../src/share/native/sun/awt/image/BufImgSurfaceData.c:31:
../../../src/solaris/native/sun/awt/awt.h:38:27: fatal error: X11/Intrinsic.h: No such file or directory
 #include <X11/Intrinsic.h>
                           ^
compilation terminated.
/usr/bin/gcc  -g   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH  -DDEBUG -DLOGGING  -DARCH='"amd64"' -Damd64 -DLINUX -DRELEASE='"1.7.0-internal-debug"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/sun/awt -I../../../src/solaris/native/sun/awt   -I/usr/X11R6//include -I/usr/X11R6//include/X11/extensions -I../../../src/solaris/native/sun/awt/font  -I../../../src/share/native/sun/awt/debug -I../../../src/share/native/sun/awt/../font -I../../../src/solaris/native/sun/awt/../font -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/shell -I../../../src/share/native/sun/awt/medialib -I../../../src/solaris/native/sun/awt/medialib -I../../../src/share/native/sun/awt/../java2d -I../../../src/solaris/native/sun/awt/../java2d -I../../../src/share/native/sun/awt/../java2d/loops -I../../../src/share/native/sun/awt/../java2d/pipe -I../../../src/share/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/x11 -I../../../src/share/native/sun/awt/../dc/doe -I../../../src/share/native/sun/awt/../dc/path -I../../../src/solaris/native/sun/awt/../jdga -I../../../src/solaris/native/sun/awt   -c -o /opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/Disposer.o  ../../../src/share/native/sun/awt/../java2d/Disposer.c
/usr/bin/gcc  -g   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH  -DDEBUG -DLOGGING  -DARCH='"amd64"' -Damd64 -DLINUX -DRELEASE='"1.7.0-internal-debug"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/sun/awt -I../../../src/solaris/native/sun/awt   -I/usr/X11R6//include -I/usr/X11R6//include/X11/extensions -I../../../src/solaris/native/sun/awt/font  -I../../../src/share/native/sun/awt/debug -I../../../src/share/native/sun/awt/../font -I../../../src/solaris/native/sun/awt/../font -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/shell -I../../../src/share/native/sun/awt/medialib -I../../../src/solaris/native/sun/awt/medialib -I../../../src/share/native/sun/awt/../java2d -I../../../src/solaris/native/sun/awt/../java2d -I../../../src/share/native/sun/awt/../java2d/loops -I../../../src/share/native/sun/awt/../java2d/pipe -I../../../src/share/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/x11 -I../../../src/share/native/sun/awt/../dc/doe -I../../../src/share/native/sun/awt/../dc/path -I../../../src/solaris/native/sun/awt/../jdga -I../../../src/solaris/native/sun/awt   -c -o /opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/Trace.o  ../../../src/share/native/sun/awt/../java2d/Trace.c
/usr/bin/gcc  -g   -fno-strict-aliasing -fPIC -W -Wall  -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer -D_LITTLE_ENDIAN -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH  -DDEBUG -DLOGGING  -DARCH='"amd64"' -Damd64 -DLINUX -DRELEASE='"1.7.0-internal-debug"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LP64=1 -I. -I/opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/solaris/javavm/export -I../../../src/share/javavm/export -I../../../src/share/native/common -I../../../src/solaris/native/common -I../../../src/share/native/sun/awt -I../../../src/solaris/native/sun/awt   -I/usr/X11R6//include -I/usr/X11R6//include/X11/extensions -I../../../src/solaris/native/sun/awt/font  -I../../../src/share/native/sun/awt/debug -I../../../src/share/native/sun/awt/../font -I../../../src/solaris/native/sun/awt/../font -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/shell -I../../../src/share/native/sun/awt/medialib -I../../../src/solaris/native/sun/awt/medialib -I../../../src/share/native/sun/awt/../java2d -I../../../src/solaris/native/sun/awt/../java2d -I../../../src/share/native/sun/awt/../java2d/loops -I../../../src/share/native/sun/awt/../java2d/pipe -I../../../src/share/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/opengl -I../../../src/solaris/native/sun/awt/../java2d/x11 -I../../../src/share/native/sun/awt/../dc/doe -I../../../src/share/native/sun/awt/../dc/path -I../../../src/solaris/native/sun/awt/../jdga -I../../../src/solaris/native/sun/awt   -c -o /opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/GraphicsPrimitiveMgr.o  ../../../src/share/native/sun/awt/../java2d/loops/GraphicsPrimitiveMgr.c
make[6]: *** [/opt/openjdk/build/../build-debug/tmp/sun/sun.awt/awt/obj64_g/BufImgSurfaceData.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[6]: Leaving directory `/opt/openjdk/jdk/make/sun/awt'
make[5]: *** [library_parallel_compile] Error 2
make[5]: Leaving directory `/opt/openjdk/jdk/make/sun/awt'
make[4]: *** [all] Error 1
make[4]: Leaving directory `/opt/openjdk/jdk/make/sun'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/openjdk/jdk/make'
make[2]: *** [jdk-build] Error 2
make[2]: Leaving directory `/opt/openjdk'
make[1]: *** [generic_debug_build] Error 2
make[1]: Leaving directory `/opt/openjdk'
make: *** [build_debug_image] Error 2
root@ThinkPad-Edge-E431:/opt/openjdk# sudo apt-get install libxt-dev

 根据http://blog.caoxudong.info/blog/2014/01/21/build_openjdk_in_ubuntu文章所说,需要

 sudo apt-get install libxt-dev

 后续还发现一些头文件缺失,按照http://blog.caoxudong.info/blog/2014/01/21/build_openjdk_in_ubuntu继续安装,我这里就直接把文章引过来了

 

 

 以上坑填完了,编译了差不多15分钟,又来一个报错,╮(╯▽╰)╭,这回感觉是翻遍整个网络都找不到答案了

省略。。。
# Running javac:
/usr/local/jdk1.6/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m -Xbootclasspath/p:/opt/openjdk/build/langtools/dist/bootstrap/lib/javac.jar -jar /opt/openjdk/build/langtools/dist/bootstrap/lib/javac.jar -g -source 7 -target 7 -encoding ascii -Xbootclasspath:/opt/openjdk/build/classes -sourcepath /opt/openjdk/build/gensrc:../../../../../src/solaris/classes:../../../../../src/share/classes -d /opt/openjdk/build/classes @/opt/openjdk/build/tmp/sun/com.sun.net.httpserver/.classes.list.filtered
make[5]: Leaving directory `/opt/openjdk/jdk/make/com/sun/net/httpserver'
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: /usr/bin/objcopy cmd found so will create .debuginfo files.
INFO: STRIP_POLICY=min_strip
INFO: ZIP_DEBUGINFO_FILES=1
make[5]: Entering directory `/opt/openjdk/jdk/make/com/sun/jmx'
/bin/mkdir -p /opt/openjdk/build/classes/javax/management/remote/rmi
rm -f /opt/openjdk/build/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.class
/opt/openjdk/build/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m -cp /opt/openjdk/build/classes sun.rmi.rmic.Main -classpath "/opt/openjdk/build/classes"    \
                -d /opt/openjdk/build/classes              \
                -v1.2                           \
                -keepgenerated                  \
                javax.management.remote.rmi.RMIConnectionImpl
/bin/mkdir -p /opt/openjdk/build/gensrc/javax/management/remote/rmi
/bin/cp       /opt/openjdk/build/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.java                                     \
                    /opt/openjdk/build/gensrc/javax/management/remote/rmi
/opt/openjdk/build/bin/java -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx512m -Xms512m -XX:PermSize=32m -XX:MaxPermSize=160m -cp /opt/openjdk/build/classes sun.rmi.rmic.Main -classpath "/opt/openjdk/build/classes"    \
                -d /opt/openjdk/build/classes              \
                -iiop -v1.2                     \
                -emitPermissionCheck            \
                javax.management.remote.rmi.RMIConnectionImpl
-emitPermissionCheck is an invalid option or argument.
Usage: rmic <options> <class names>

where <options> includes:
  -keep          Do not delete intermediate generated source files
  -keepgenerated (same as "-keep")
  -v1.1          Create stubs/skeletons for 1.1 stub protocol version
  -vcompat       Create stubs/skeletons compatible with both
                           1.1 and 1.2 stub protocol versions
  -v1.2          (default) Create stubs for 1.2 stub protocol version only
  -iiop          Create stubs for IIOP. When present, <options> also includes:

                   -always           Create stubs even when they appear current
                   -alwaysgenerate   (same as "-always")
                   -nolocalstubs     Do not create stubs optimized for same process

  -idl           Create IDL. When present, <options> also includes:

                   -noValueMethods   Do not generate methods for valuetypes 
                   -always           Create IDL even when it appears current
                   -alwaysgenerate   (same as "-always")

  -g             Generate debugging info
  -nowarn        Generate no warnings
  -nowrite       Do not write compiled classes to the file system
  -verbose       Output messages about what the compiler is doing
  -classpath <path>      Specify where to find input class files
  -bootclasspath <path>  Override location of bootstrap class files
  -extdirs <path>        Override location of installed extensions
  -d <directory>         Specify where to place generated class files
  -J<runtime flag>       Pass argument to the java interpreter

make[5]: *** [/opt/openjdk/build/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.class] Error 1
make[5]: Leaving directory `/opt/openjdk/jdk/make/com/sun/jmx'
make[4]: *** [all] Error 1
make[4]: Leaving directory `/opt/openjdk/jdk/make/com/sun'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/openjdk/jdk/make/com'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/opt/openjdk/jdk/make'
make[1]: *** [jdk-build] Error 2
make[1]: Leaving directory `/opt/openjdk'
make: *** [build_product_image] Error 2

 

 一直卡在这个问题上,也不是办法,换了个源码版本

wget http://download.java.net/openjdk/jdk7u40/promoted/b43/openjdk-7u40-fcs-src-b43-26_aug_2013.zip

,再编译下,还是用的那个build.sh脚步,编译成功了,有时间给社区去提下这个问题

RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/jstat
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/javap
Library loads for: /opt/openjdk/build/j2sdk-image/bin/javap
	linux-vdso.so.1 =>  (0x00007ffcc9df9000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002ab6e9613000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002ab6e9847000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002ab6e9c0c000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002ab6e9e10000)
	/lib64/ld-linux-x86-64.so.2 (0x000055e4bc09a000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/javap
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/jhat
Library loads for: /opt/openjdk/build/j2sdk-image/bin/jhat
	linux-vdso.so.1 =>  (0x00007ffe017d5000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b30c4438000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b30c466c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b30c4a31000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b30c4c35000)
	/lib64/ld-linux-x86-64.so.2 (0x00005563b6ba1000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/jhat
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/apt
Library loads for: /opt/openjdk/build/j2sdk-image/bin/apt
	linux-vdso.so.1 =>  (0x00007fffe1d34000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b905cf25000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b905d159000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b905d51e000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b905d722000)
	/lib64/ld-linux-x86-64.so.2 (0x000056405d275000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/apt
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/wsimport
Library loads for: /opt/openjdk/build/j2sdk-image/bin/wsimport
	linux-vdso.so.1 =>  (0x00007ffec19ea000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b277340b000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b277363f000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b2773a04000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b2773c08000)
	/lib64/ld-linux-x86-64.so.2 (0x0000559c16d3f000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/wsimport
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/rmid
Library loads for: /opt/openjdk/build/j2sdk-image/bin/rmid
	linux-vdso.so.1 =>  (0x00007ffcabd98000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b3e22052000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b3e22286000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b3e2264b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b3e2284f000)
	/lib64/ld-linux-x86-64.so.2 (0x0000560f9eeff000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/rmid
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/orbd
Library loads for: /opt/openjdk/build/j2sdk-image/bin/orbd
	linux-vdso.so.1 =>  (0x00007ffd241fa000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b72883a3000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b72885d7000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b728899c000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b7288ba0000)
	/lib64/ld-linux-x86-64.so.2 (0x0000564ad1272000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/orbd
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/jar
Library loads for: /opt/openjdk/build/j2sdk-image/bin/jar
	linux-vdso.so.1 =>  (0x00007ffd2f7fb000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002ad66df97000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002ad66e1cb000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002ad66e590000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002ad66e794000)
	/lib64/ld-linux-x86-64.so.2 (0x0000563d9fc07000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/jar
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/rmiregistry
Library loads for: /opt/openjdk/build/j2sdk-image/bin/rmiregistry
	linux-vdso.so.1 =>  (0x00007fffb113e000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b8c0825f000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b8c08493000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b8c08858000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b8c08a5c000)
	/lib64/ld-linux-x86-64.so.2 (0x0000562096ee5000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/rmiregistry
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/idlj
Library loads for: /opt/openjdk/build/j2sdk-image/bin/idlj
	linux-vdso.so.1 =>  (0x00007fffbd3cd000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002af17f710000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002af17f944000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002af17fd09000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002af17ff0d000)
	/lib64/ld-linux-x86-64.so.2 (0x0000556b7e19f000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/idlj
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/policytool
Library loads for: /opt/openjdk/build/j2sdk-image/bin/policytool
	linux-vdso.so.1 =>  (0x00007ffdeedf3000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002b8c25b1f000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b8c25d53000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b8c26118000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002b8c2631c000)
	/lib64/ld-linux-x86-64.so.2 (0x0000557ced20b000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/policytool
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
Checking for mapfile use in: /opt/openjdk/build/j2sdk-image/bin/jcmd
Library loads for: /opt/openjdk/build/j2sdk-image/bin/jcmd
	linux-vdso.so.1 =>  (0x00007fffee516000)
	libjli.so => /opt/openjdk/build/j2sdk-image/bin/../jre/lib/amd64/jli/libjli.so (0x00002ac277084000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002ac2772b8000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002ac27767d000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00002ac277881000)
	/lib64/ld-linux-x86-64.so.2 (0x000056337d75b000)
RUNPATH for: /opt/openjdk/build/j2sdk-image/bin/jcmd
 0x0000000000000001 (NEEDED)             Shared library: [libjli.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
rm -f /opt/openjdk/build/tmp/jdk-bin-files.list
>>>Making sec-files @ Sun Oct 22 20:42:51 CST 2017 ...
/bin/mkdir -p .
rm -f sec-files
rm -f /opt/openjdk/build/tmp/sec-bin.zip
cd  /opt/openjdk/build && \
		/usr/bin/zip -rq9 /opt/openjdk/build/tmp/sec-bin.zip classes/javax/net classes/javax/security/cert classes/com/sun/net/ssl classes/com/sun/security/cert classes/sun/net/www/protocol/https classes/sun/security/pkcs12 classes/sun/security/ssl classes/sun/security/krb5/*.class classes/sun/security/krb5/internal/*.class classes/sun/security/krb5/internal/ccache classes/sun/security/krb5/internal/crypto classes/sun/security/krb5/internal/ktab classes/sun/security/krb5/internal/rcache classes/sun/security/krb5/internal/util classes/sun/security/jgss/spi/GSSContextSpi.class
>>>Making sec-files-win @ Sun Oct 22 20:42:51 CST 2017 ...
>>>Making jgss-files @ Sun Oct 22 20:42:51 CST 2017 ...
>>>Making server-jdk-image @ Sun Oct 22 20:42:51 CST 2017 ...
rm -f -r /opt/openjdk/build/j2sdk-server-image
/bin/cp -r /opt/openjdk/build/j2sdk-image /opt/openjdk/build/j2sdk-server-image
rm -f -r /opt/openjdk/build/j2sdk-server-image/demo
rm -f -r /opt/openjdk/build/j2sdk-server-image/sample
rm -f /opt/openjdk/build/j2sdk-server-image/bin/jcontrol
rm -f /opt/openjdk/build/j2sdk-server-image/jre/bin/jcontrol
rm -f /opt/openjdk/build/j2sdk-server-image/man/ja_JP.UTF-8/man1/javaws.1
rm -f /opt/openjdk/build/j2sdk-server-image/man/man1/javaws.1
>>>Finished making images @ Sun Oct 22 20:42:51 CST 2017 ...
make[2]: Leaving directory `/opt/openjdk/jdk/make'
########################################################################
##### Leaving jdk for target(s) sanity all  images                 #####
########################################################################
##### Build time 00:06:21 jdk for target(s) sanity all  images     #####
########################################################################

#-- Build times ----------
Target debug_build
Start 2017-10-22 20:30:29
End   2017-10-22 20:42:51
00:05:26 hotspot
00:06:21 jdk
00:00:35 langtools
00:12:22 TOTAL
-------------------------
make[1]: Leaving directory `/opt/openjdk'

 

 

 

对于debug版,可以用下面的命令来查看编绎出来的java示持哪些JVM的配置项:

 

./java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -XX:+PrintFlagsWithComments -version

 /opt/openjdk/build-debug/bin/java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -XX:+PrintFlagsWithComments -version

如果是非debug,则可以使用下面的命令来输出可用的JVM配置项:

 

./java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

 

 

 

可以了

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file /opt/openjdk/build
build/       build-debug/ build.sh     
(gdb) file /opt/openjdk/build/
^A�                      bundles/                 gensrc/                  j2sdk-server-image/      sanityCheckWarnings.txt
bin/                     classes/                 hotspot/                 langtools/               source-bundles/
btbins/                  demo/                    impsrc/                  lib/                     source_tips
btclasses/               democlasses/             include/                 linux-amd64/             symbols/
btjars/                  demos-bundles/           j2re-image/              sample/                  tmp/
build.log                gennativesrc/            j2sdk-image/             sanityCheckMessages.txt  
(gdb) file /opt/openjdk/build/hotspot/
import/    outputdir/ 
(gdb) file /opt/openjdk/build/hotspot/outputdir/linux_amd64_
linux_amd64_compiler2/ linux_amd64_docs/      
(gdb) file /opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/
debug/           fastdebug/       generated/       jvmg/            optimized/       product/         profiled/        shared_dirs.lst
(gdb) file /opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/gamma 
Reading symbols from /opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/gamma...done.
(gdb) en
enable  end     
(gdb) set args A 1987
(gdb) break main
Breakpoint 1 at 0x402ff3: file /opt/openjdk/hotspot/src/share/tools/launcher/java.c, line 228.
(gdb) run
Starting program: /opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/gamma A 1987
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=3, argv=0x7fffffffdc58) at /opt/openjdk/hotspot/src/share/tools/launcher/java.c:228
228	{
(gdb) 

 

 

 后来吧/etc/profile改了下:

#export JAVA_HOME=/usr/local/jdk1.8
export JAVA_HOME=/opt/openjdk/build/j2sdk-image
export ANT_HOME=/usr/local/ant1.9.4
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$ANT_HOME/bin:$PATH

 还有是把/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/目录下的env.sh改了下,

注意/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/gamma的运行依赖/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/libjvm.so

# Generated by /opt/openjdk/hotspot/make/linux/makefiles/buildtree.make
: ${JAVA_HOME:=/usr/local/jdk1.6}
CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/jre/lib/i18n.jar
HOTSPOT_BUILD_USER="root in hotspot"
export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER
LD_LIBRARY_PATH=/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg:$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/native_threads
export LD_LIBARAY_PATH
~                           

 

打印jvmpath值 $4 = "/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/libjvm.so", '\000' <repeats 751 times>...

 

(gdb) set environment LD_LIBRARY_PATH=/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg:$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/native_threads

 

 

(gdb) 
281	    ifn.GetDefaultJavaVMInitArgs = 0;
(gdb) 
283	    if (_launcher_debug)
(gdb) 
285	    if (!LoadJavaVM(jvmpath, &ifn)) {
(gdb) 
288	    if (_launcher_debug) {
(gdb) 
300	    progname = *argv;
(gdb) 
301	    if ((s = strrchr(progname, FILE_SEPARATOR)) != 0) {
(gdb) 
302	        progname = s + 1;
(gdb) 
306	    ++argv;
(gdb) 
307	    --argc;
(gdb) 
318	    if ((s = getenv("CLASSPATH")) == 0) {
(gdb) 
322	    SetClassPath(s);
(gdb) 
329	    if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret, jvmpath)) {
(gdb) 
334	    if (jarfile != 0) {
(gdb) 
339	    SetJavaCommandLineProp(classname, jarfile, argc, argv);
(gdb) 
342	    SetJavaLauncherProp();
(gdb) p *jarfile
Cannot access memory at address 0x0
(gdb) p jarfile
$1 = 0x0
(gdb) p classname
$2 = 0x7fffffffe037 "A"
(gdb) p ret
$3 = 1
(gdb) p jvmpath
$4 = "/opt/openjdk/build/hotspot/outputdir/linux_amd64_compiler2/jvmg/libjvm.so", '\000' <repeats 751 times>...

 

 

本机环境如下:

[henry@henry-ubuntu:~/program/java/oracle_jdk/jdk1.7.0_51]$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode)

[henry@henry-ubuntu:~/workspace/openjdk/openjdk-7u40-fcs-src-b43-26_aug_2013/openjdk]$ uname -a
Linux henry-ubuntu 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux

默认全部编译

主要参考文档:README-builds.html,在源代码目录就有。

过程:

  1. 安装mercurial

  2. 下载某个repository(repository与project的区别,参见http://openjdk.java.net/guide/repositories.html

  3. 执行脚本get_source.sh以获取源代码。

  4. 设置基本环境变量。

    export LANG=C 
    export ALT_BOOTDIR=$JAVA_HOME 
    export JAVA_HOME= 
    export CLASSPATH=
    
  5. 相关依赖库

    5.1 安装CUPs,如果安装的时候制定了自定义目录,则还需要配置环境变量ALT_CUPS_HEADERS_PATH

    sudo apt-get install cups-common
    sudo apt-get install libcups2-dev
    

    5.2 安装FreeType,需要2.3以上的版本。如果安装的时候制定了自定义目录,则还需要配置环境变量ALT_FREETYPE_LIB_PATHALT_FREETYPE_HEADERS_PATH

    sudo apt-get install libfreetype6
    sudo apt-get install libfreetype6-dev
    

    5.3 安装ALSA,这个就不要自定义安装了

    sudo apt-get alsa-base
    sudo apt-get alsa-utils
    sudo apt-get install libclalsadrv2
    sudo apt-get install libclalsadrv-dev
    
  6. 至此make sanity应该可以通过了,然后make。

  7. make时的错误

    • 找不到gawk

        sudo apt-get install gawk
      
    • 找不到X11库,执行

        sudo apt-get install libx11-dev 
      
    • fatal error: X11/extensions/shape.h: No such file or directory,执行

        sudo apt-get install libxext-dev
      
    • fatal error: X11/extensions/Xrender.h: No such file or directory,执行

        sudo apt-get install libxrender-dev
      
    • fatal error: X11/extensions/XTest.h: No such file or directory,执行

        sudo apt-get install libxtst-dev
      
    • fatal error: X11/Intrinsic.h: No such file or directory,执行

        sudo apt-get install libxt-dev
      

    如果还有缺少库的情况,可以到这里http://packages.ubuntu.com/搜索。

  8. 继续make时的错误

    • 权限错误

        /home/henry/program/java/oracle_jdk/jdk1.7.0_51/bin/javac -g -encoding ascii -source 6 -target 6 -classpath /home/henry/program/java/oracle_jdk/jdk1.7.0_51/lib/tools.jar -sourcepath /media/sf_win7_e_drive/workspace/openjdk/openjdk-7u6-fcs-src-b24-28_aug_2012/openjdk/hotspot/agent/src/share/classes -d /media/sf_win7_e_drive/workspace/openjdk/openjdk-7u6-fcs-src-b24-28_aug_2012/openjdk/build/linux-i586/hotspot/outputdir/linux_i486_compiler2/product/../generated/saclasses @/media/sf_win7_e_drive/workspace/openjdk/openjdk-7u6-fcs-src-b24-28_aug_2012/openjdk/build/linux-i586/hotspot/outputdir/linux_i486_compiler2/product/../generated/agent.classes.list
              
        warning: [options] bootstrap class path not set in conjunction with -source 1.6
        /media/sf_win7_e_drive/workspace/openjdk/openjdk-7u6-fcs-src-b24-28_aug_2012/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser.java:333: error: error while writing COFFFileParser.COFFFileImpl.COFFHeaderImpl.OptionalHeaderWindowsSpecificFieldsImpl: /media/sf_win7_e_drive/workspace/openjdk/openjdk-7u6-fcs-src-b24-28_aug_2012/openjdk/build/linux-i586/hotspot/outputdir/linux_i486_compiler2/product/../generated/saclasses/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser$COFFFileImpl$COFFHeaderImpl$OptionalHeaderWindowsSpecificFieldsImpl.class (Operation not permitted)
              
        class OptionalHeaderWindowsSpecificFieldsImpl implements OptionalHeaderWindowsSpecificFields {
        ^
              
        Note: Some input files use unchecked or unsafe operations.
        Note: Recompile with -Xlint:unchecked for details.
      

      没找到具体原因,猜测是与使用了virtualbox,并将编译编译结果输出到windows的共享目录相关。

      变通方法,设置ALT_OUTPUTDIR变量,将编译结果输出到virtualbox的虚拟硬盘中,重新make。

    • 找不到类

        cd linux_i486_compiler2/product && ./test_gamma
        Using java runtime at: /home/henry/program/java/oracle_jdk/jdk1.7.0_51/jre
        Error occurred during initialization of VM
        java/lang/NoClassDefFoundError: java/lang/invoke/AdapterMethodHandle
      

      在classpath中确实没找到AdapterMethodHandle这个类,从下面两个邮件列表中的问题看,应该是新旧两个虚拟机不兼容,所以重新下载源码(openjdk-7u40-fcs-src-b43-26_aug_2013)再编译

  9. make成功

    32bit

    #-- Build times ----------
    Target all_product_build
    Start 2014-01-21 19:50:53
    End   2014-01-21 20:31:48
    00:00:20 corba
    00:01:26 hotspot
    00:01:08 jaxp
    00:01:48 jaxws
    00:35:25 jdk
    00:00:48 langtools
    00:40:55 TOTAL
    

    64bit

    #-- Build times ----------
    Target all_product_build
    Start 2014-01-26 14:36:02
    End   2014-01-26 16:31:03
    00:07:00 corba
    00:37:02 hotspot
    00:02:48 jaxp
    00:04:15 jaxws
    01:01:14 jdk
    00:02:41 langtools
    01:55:01 TOTAL
    

    电脑矬真是苦逼,时间长的令人发指。

  10. 运行一下

32bit

    [henry@henry-ubuntu:~/program/java/openjdk/openjdk-7u40-fcs-src-b43-26_aug_2013/bin]$ ./java -version
    openjdk version "1.7.0-internal"
    OpenJDK Runtime Environment (build 1.7.0-internal-henry_2014_01_21_09_17-b00)
    OpenJDK Client VM (build 24.0-b56, mixed mode)

64bit

    [henry@ubuntu:~/program/java/open_jdk/jdk7u40]$ bin/java -version
    openjdk version "1.7.0-internal"
    OpenJDK Runtime Environment (build 1.7.0-internal-henry_2014_01_26_14_35-b00)
    OpenJDK 64-Bit Server VM (build 24.0-b56, mixed mode)

定制化编译

openjdk的编译参数

//TODO: 定制化编译openjdk的某个部分