build sun jdk1.6 源代码

最近为了研究jvm, 尝试build java 源代码。

网上有一些openjdk build教程,但是为了后期测试与应用方便,还是选定sun jdk.

感谢RednaxelaFX 同学的帮助,最终结果如下:

http://hllvm.group.iteye.com/group/topic/27149


1. 虽然jdk1.6 README-builds.html 里说要jdk1.5作为Bootstrap, 其实是要求1.6, 所以要先下载安装sun jdk-6u26-linux-x64.bin
注意这里用opensdk 是不行的,没有javap

2. 环境变量设置如下:
ALT_BOOTDIR=/tmp/jdk1.6.0_26
ALT_DEVTOOLS_PATH=/usr/bin
DEVTOOLS_PATH=/usr/bin
LANG=C

3. 安装cups, 下载并build cups-1.5.0-source.tar.bz2

4. 不知道为什么,下载的jdk1.6源码中少了字体文件,ERROR: Missing ./../src/share/lib/fonts/LucidaTypewriterRegular.ttf. 
       Verify you have downloaded and overlayed on the source area all the binary files. 
不管它了,从现有的jre 里拷过来。

5. make dev-sanity 有一些warning, 先不管。

6. 执行make dev-sanity BUILD_DEPLOY=false SKIP_COMPARE_IMAGES=true ALT_BOOTDIR=/tmp/jdk1.6.0_26 ALT_DEVTOOLS_PATH=/usr/bin HOTSPOT_BUILD_JOBS=2

等着......明天来看结果


偶的新机器真快,20分钟不到就结束了,
和这里一样报错,看来还得来一次:http://rednaxelafx.iteye.com/blog/875957

make[3]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[3]: *** No rule to make target `/usr/X11R6/lib/X11/config/Imake.tmpl', needed by `xmkmf'.  Stop.
make[3]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[2]: *** [util/mkcatdefs] Error 2
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[2]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
(cd util; make)
make[3]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[3]: *** No rule to make target `/usr/X11R6/lib/X11/config/Imake.tmpl', needed by `xmkmf'.  Stop.
make[3]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[2]: *** [util/mkcatdefs] Error 2
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[1]: *** [motif-build] Error 2
make[1]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/control/make'
make: *** [dev-build] Error 2


现场直播, 报错了
make[3]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[3]: *** No rule to make target `/usr/X11R6/lib/X11/config/Imake.tmpl', needed by `xmkmf'.  Stop.
make[3]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[2]: *** [util/mkcatdefs] Error 2
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[2]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
(cd util; make)
make[3]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[3]: *** No rule to make target `/usr/X11R6/lib/X11/config/Imake.tmpl', needed by `xmkmf'.  Stop.
make[3]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
make[2]: *** [util/mkcatdefs] Error 2
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[1]: *** [motif-build] Error 2
make[1]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/control/make'
make: *** [dev-build] Error 2

估计是x11库的问题,检查jdk6_src\motif\lib\Xm\util\Makefile,用到了/usr/X11R6/lib

我的本机是没有这个目录的,从/usr/share 下找到了X11, 拷到/usr/X11R6/lib这里。

再build,还有错:
gcc      -I/usr/X11R6/include    -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE   -DFUNCPROTO=15 -DNARROWPROTO     -c -o mkcatdefs.o mkcatdefs.c
mkcatdefs.c: In function 'mkcatdefs':
mkcatdefs.c:350: warning: cast to pointer from integer of different size
mkcatdefs.c:402: warning: cast to pointer from integer of different size
rm -f mkcatdefs
gcc -o mkcatdefs        mkcatdefs.o       
gcc      -I/usr/X11R6/include    -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE   -DFUNCPROTO=15 -DNARROWPROTO     -c -o lndir.o lndir.c
lndir.c: In function 'quit':
lndir.c:104: warning: incompatible implicit declaration of built-in function 'exit'
lndir.c: In function 'quiterr':
lndir.c:112: warning: incompatible implicit declaration of built-in function 'exit'
lndir.c: In function 'main':
lndir.c:353: warning: incompatible implicit declaration of built-in function 'exit'
rm -f lndir
gcc -o lndir        lndir.o       
make[3]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm/util'
rm -f XmMsgI.h XmMsgCatI.h Xm.cat
./util/mkmsgcat -Xm ./Messages.c
mv -f Xm.msg Xm1.msg
./util/mkcatdefs XmMsgCatI.h Xm1.msg > Xm.msg
mkcatdefs: XmMsgCatI.h created
rm -f Xm1.msg
rm -f Xm.cat
gencat  Xm.cat ./Xm.msg
./Xm.msg:2: unknown directive `': line ignored
./Xm.msg:16: unknown directive `': line ignored
make[2]: *** [Xm.cat] Error 1
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[2]: Entering directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
mkdir unshared
ln -s ../bindings/unshared unshared/bindings
ln: creating symbolic link `unshared/bindings' to `../bindings/unshared': Operation not supported
ln -s ../util/unshared unshared/util
ln: creating symbolic link `unshared/util' to `../util/unshared': Operation not supported
make[2]: *** [includes] Error 1
make[2]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/motif/lib/Xm'
make[1]: *** [motif-build] Error 2
make[1]: Leaving directory `/mnt/hgfs/workplace/jdk6_src/control/make'
make: *** [dev-build] Error 2

估计还是X11问题,都怪俺装Centos时以为不会做X11 开发,安装省了许多相关库


经过多次折腾,今天张全部搞定了。
不知道什么原因,下载的src 包里总是少了各样的gif, wav等资源文件。
(需要的同学可以联系我,我都在网上找全的)

另外在amd64位下要改下\jdk6_src\j2se\make\sun\jdbc\Makefile 里$(TEMPDIR)/libodbcinst.so: dummyodbc.c  $(TEMPDIR)
$(CC) -shared -fPIC -o $@ $<
$(TEMPDIR)/libodbc.so: dummyodbc.c $(TEMPDIR) 
$(CC) -shared -fPIC -o $@ $<

你可能感兴趣的:(build sun jdk1.6 源代码)