关闭

java-编译openJdk

624人阅读 评论(0) 收藏 举报
分类:

软件环境

OS:CentOS 6.5

openJdk:openjdk-7-fcs-src-b147-27_jun_2011.zip

准备工作

下载opendk

解压

unzip openjdk-7-fcs-src-b147-27_jun_2011.zip

安装依赖
# yum -y install gcc gcc-c++ alsa-lib alsa-lib-devel libXrender libXrender-devel libXi-devel libXt-devel libXtst-devel cups cups-devel


下载安装freetype

下载freetype-2.4.0.tar.gz ,

解压 tar -zxvf freetype-2.4.0.tar.gz

解压后 cd  freetype-2.4

执行命令 ./configure && make && make install


安装ant

下载ant  我下的是apache-ant-1.9.7-bin.tar.gz版本

解压 tar -zxvf apache-ant-1.9.7-bin.tar.gz

解压后把ant命令加入bin

# ln -s /usr/local/apache-ant-1.9.7/bin/ant  /usr/bin/ant


安装BootstrapJDK

版本要参照README-builds.html (在openjdk目录下)

我下载的是jdk-6u45-linux-x64.bin版本

下载后 执行 ./jdk-6u45-linux-x64.bin


配置环境变量

编辑文件vi ~/.bash_profile加入以下变量


export LANG=C
export ALT_BOOTDIR=/usr/local/jdk1.6.0_45
export ALT_JDK_IMPORT_PATH=/usr/local/jdk1.6.0_45
export ANT_HOME=/usr/local/apache-ant-1.9.7
export ALT_FREETYPE_HEADERS_PATH=/usr/local/include/freetype2
export ALT_FREETYPE_LIB_PATH=/usr/local/lib
export ALLOW_DOWNLOADS=true
export SKIP_DEBUG_BUILD=false
export SKIP_FASTDEBUG_BUILD=true
export DEBUG_NAME=debug
unset JAVA_HOME
unset CLASSPATH

使变量生效
# source ~/.bash_profile


测试环境是否健全

进入解压后的openjdk-7-fcs-src-b147-27_jun_2011.zip

cd openjdk

执行 make sanity
如果输出以下内容则表示通过,可以进行编译

Sanity check passed.


编译openjdk

进入解压后的openjdk-7-fcs-src-b147-27_jun_2011.zip

cd openjdk

build:

命令格式:gmake [ARCH_DATA_MODEL=32 or 64] [ALT_OUTPUTDIR=output_directory] [other "ALT_" overrides]

我用的是 gmake ARCH_DATA_MODEL=64

编译失败后清理:make clean


编译成功后会看到

-- Build times ----------
Target debug_build
Start 2016-08-30 15:03:19
End   2016-08-30 15:45:05
00:04:41 corba
00:09:35 hotspot
00:01:39 jaxp
00:01:37 jaxws
00:22:58 jdk
00:01:16 langtools
00:41:46 TOTAL

编译中遇到的问题

Bootstrap jdk版本不对

参照README-builds.html下载正确版本的jdk

Using java runtime at: /opt/jdk1.7.0_04/jre

Error occurred during initialization of VM
Unable to load native library: /opt/jdk1.7.0_04/jre/lib/i386/libjava.so: symbol JVM_SetNativeThreadName, version SUNWprivate_1.1 not defined in file libjvm.so with link time reference
make[4]: *** [product] Error 1
make[4]: Leaving directory `/media/sf_E_DRIVE/learn/java/openjdk/openjdk/build/linux-i586/hotspot/outputdir'
make[3]: *** [generic_build2] Error 2
make[3]: Leaving directory
`/media/sf_E_DRIVE/learn/java/openjdk/openjdk/hotspot/make'
make[2]: *** [product] Error 2
make[2]: Leaving directory `/media/sf_E_DRIVE/learn/java/openjdk/openjdk/hotspot/make'
make[1]: *** [hotspot-build] Error 2
make[1]: Leaving directory `/media/sf_E_DRIVE/learn/java/openjdk/openjdk'

make: *** [build_product_image] Error 2


time is more than 10 years from present

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)

# 解决办法
# 修改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



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:24182次
    • 积分:793
    • 等级:
    • 排名:千里之外
    • 原创:52篇
    • 转载:24篇
    • 译文:0篇
    • 评论:5条
    文章分类
    最新评论