http://happyenjoylife.iteye.com/blog/858147

Ubuntu10.04下build OpenJDK7 的过程

1. 安装mercurial
Mercurial是一个版本管理工具。
sudo apt-get install mercurial

安装mercurial的扩展,添加fclone在支持
hg clone http://bitbucket.org/pmezard/hgforest-crew

将以下内容添加到$HOME/.hgrc文件中,如果没有则自己创建一个:
[extensions]
forest=/home/daren/hgforest-crew/forest.py
fetch=

2. 下载jdk7源码
hg fclone http://hg.openjdk.java.net/jdk7/jdk7

3. 安装gcc、g++、make等
sudo apt-get install build-essential

4. 安装XRender
sudo apt-get install libxrender-dev
sudo apt-get install xorg-dev

5. 安装alsa
sudo apt-get install libasound2-dev

6. Cups
sudo apt-get install libcups2-dev

7. 安装jdk6

8. 安装ant
设置ANT_HOME
9. 安装findbugs
编译需要这玩意儿有点奇怪。需要设置FINDBUGS_HOME

10. 测试编译
export LANG=C ALT_BOOTDIR=/opt/jdk1.6.0_22/
#删除JAVA_HOME
export -n JAVA_HOME
export ALT_JDK_IMPORT_PATH=/opt/jdk1.6.0_22/
make sanity BUILD_JAXWS=false BUILD_JAXP =false

在build BUILD_JAXWS和BUILD_JAXP总是提示找不到源文件,而我又暂时对只对JDK、Hotspot感兴趣,所以索性把这两个给去掉。

如果出现:Sanity check passed.则表示测试编译通过了,不过也别开心得太早,真正make的时候不保证一定没问题,也许还会缺少某些依赖。

11. 编译
export LANG=C ALT_BOOTDIR=/opt/jdk1.6.0_22/
#删除JAVA_HOME
export -n JAVA_HOME
export ALT_JDK_IMPORT_PATH=/opt/jdk1.6.0_22/
#make BUILD_JAXWS=false BUILD_JAXP=false
#make DEBUG_NAME=fastdebug BUILD_JAXWS=false BUILD_JAXP=false
make DEBUG_NAME=all_fastdebug BUILD_JAXWS=false BUILD_JAXP=false

More Reference

http://feralchicken.wordpress.com/2009/02/20/building-openjdk-under-ubuntu/

Building OpenJDK under Ubuntu

Shame: There was a typo in the command to clone jdk7 from the repo. The command below is now correct. Apologies for the confusion

Manually building a large project really gives me an appreciation for how well the portage system in Gentoo automates the build process. To think that the process of pulling in dependencies, getting the source, applying patches, configuring, building, and merging binaries into a live system is executed by contributed ebuild scripts is very amazing, especially when you see it all before your very eyes. Unfortunately, searching for dependencies and setting up your build environment can be hectic, and the less patient miss out on an awesome experience.

This guide is dedicated to building OpenJDK entirely from the command line under Ubuntu 8.04. Assume all commands are executed in the directory where we will do all our work. Also, don’t forget to replace the instances of atsui (my username) with your own

Install and configure Mercurial

First we’ll set up Mercurial, a distributed source control tool.

sudo apt-get install mercurial

We also want to set up Forest, an Mercurial extension that will let us recursively pull the entire OpenJDK from the repository. This command uses Mercurial to grab the extension and put it under the forest folder, which contains a python script we want called forest.py .

1 hg clone http: / / bitbucket.org / pmezard / hgforest - crew forest

Paste the following into .hgrc under your home directory to set up Forest.

[ui]
username = atsui
[extensions]
forest=/path/to/forest.py
fetch=

You can check it works by typing in a command provided by Forest, eg.

hg fclone

Clone a copy of OpenJDK

Now let’s grab the JDK! This command puts everything in jdk7 :

hg fclone http://hg.openjdk.java.net/jdk7/jdk7 jdk7

Fetch the binary plugs

OpenJDK still depends on some closed source blobs, which can be acquired and unpacked as follows:

1 wget http: / / www.java.net / download / openjdk / jdk7 / promoted / b48 / jdk - 7 - ea - plug - b48 - linux - i586 - 19_feb_2009 .jar
2  
3 # accept the license agreement and install to cwd
4 java - jar jdk - 7 - ea - plug - b48 - linux - i586 - 19_feb_2009 .jar

Judging from the filename, perhaps this is frequently updated. Check out the downloads for the latest file.

Install library dependencies

Building from source often happens against various other libraries. Here is some of what I found was needed:

1 sudo apt - get install build - essential gawk libasound2 - dev libfreetype6 - dev libcups2 - dev libxt - dev libx11 - dev libxtst - dev

Configure the build environment

These commands will configure the build environment, but you should manually check your environment variables and unset anything related to java ! A mysterious problem I ran into on my Gentoo box had to do with the fact that although I had unset JAVA_HOME and CLASSPATH , which the makefile checks for, I still had JAVAC and JDK_HOME set, which caused some mysterious hidden package errors. Find them and unset them before you build. The last command will check to see if the environment is reasonably prepared.

1 export ALT_BOOTDIR = / usr / lib / jvm / java - 6 - sun
2 export ALT_BINARY_PLUGS_PATH = / path / to / openjdk - binary - plugs
3 export LANG = "C"
4 unset JAVA_HOME
5 unset CLASSPATH
6 cd jdk7
7 make sanity

Build OpenJDK

This will start the build, which may halt on missing dependency errors.

make

Watch 24

Go and enjoy an episode of 24 . Actually, the build takes a little longer than the time of one episode, so maybe you can make some popcorn while you’re at it.

With any luck, you will see this when you come back:

Control linux i586 1.7.0-internal build_product_image build finished:
Control linux i586 1.7.0-internal all_product_build build finished:
Control linux i586 1.7.0-internal all build finished:

You can then run

build/linux-i586/bin/java -version

to test your freshly baked OpenJDK, which should give something like

openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-atsui_2009_02_20_21_40-b00)
OpenJDK Client VM (build 15.0-b01, mixed mode)

Hopefully, that was pretty painless. Enjoy

Ubuntu10.04下build OpenJDK7 的过程相关推荐

  1. ubuntu10.04下audacious2.4源码编译过程(解决2.3cue的bug)

    本文最新版本:ubuntu10.04下audacious2.5源码编译过程 编译最新的2.4是为了解决ubuntu源中安装的audacious播放cue时有bug,会一直重复第一首歌 听ape的时候很 ...

  2. 在ubuntu10.04下 GStreamer开发环境搭建

    在ubuntu10.04下 GStreamer开发环境搭建 一 安装gstreamer 1 下载gstreamer源码 http://gstreamer.freedesktop.org/src/gst ...

  3. Ubuntu10.04下gFtp2.0.19 远程客户端中文乱码解决方法

    Ubuntu10.04下gFtp2.0.19 远程客户端中文乱码解决方法如下: 1.打开"gFTP-FTP-属性-常规-远程字符集": 2.将远程字符集设置为:gb2312,gbk ...

  4. ubuntu10.04下安装windows7

    ubuntu10.04下安装windows7 一直是xp与Ubuntu10.04的双系统,最近xp出奇的慢,遂想把xp换成win7.在网上一查,大多装win7的都是在装好win7的情况下再装Ubunt ...

  5. ubuntu10.04下 简单配置samba

    ubuntu10.04下 简单配置samba,实现windows xp 访问linux 共享夹 关键字: ubuntu samba 今天在家,闲着没事,就想学习一下samba 来实现windows x ...

  6. ubuntu10.04下安装 sopcast

    2019独角兽企业重金招聘Python工程师标准>>> xmarklet网络书签,收集自己的网络书签,创建自己的网站导航. http://www.kmimagine.com/xmar ...

  7. Ubuntu10.04下Linux内核编译的完整步骤

    [转] http://supportopensource.iteye.com/blog/680483 1.在http://www.kernel.org/上下载最新的内核源代码linux-2.6.33. ...

  8. ubuntu10.04下安装fcitx小企鹅输入法,配置,美化及删除多余码表

    今天晚上装了很久的fcitx,貌似还是没有到达我的要求.还是不爽.但是这个输入法还是比前两个还是要快些拉.下面这个方法还是比较全的.希望转过来对大家有帮助. 转于:http://hi.baidu.co ...

  9. ubuntu 安装中文字库_在ubuntu10.04下安装中文字体

    Ubuntu10.04(下载)中的中文字体太少,对平时使用惯了Windows的人来说非常不便. 用下面的方法可以很方便的在Ubuntu10.04中添加自己喜欢的Vista字体. 1.从Vista的字体 ...

最新文章

  1. html5 Web Workers
  2. 怎么用python做表格-怎么用python画表格?
  3. 笔记-项目采购管理-合同类型-成本加激励费用合同
  4. 在往sql server 插入数据时 报此错误“ 消息 8152,级别 16,状态 14,第 1 行 将截断字符串或二进制数据。”...
  5. ceil和floor
  6. python的输出函数_Python
  7. 内固定取出术后护理_股骨内固定钢板取出术后护理查房记录范文
  8. linux系统监控必备两款软件
  9. 有做行业站的转行做企业站的吗?
  10. 《脱颖而出——成功网店经营之道》一2.5 后方——不可忽视的金库
  11. Bailian4044 小白鼠再排队【排序】
  12. prototype中文参数乱码解决方案
  13. JAVA打印数组的四种方法
  14. webgl 地球_使用WebGL和JavaScript构建地球
  15. 微信安卓6.5.3以上版本网页上传不了图片的解决方案
  16. 递归下降分析法实现强化计算器
  17. 微信小程序:九宫格抽奖
  18. ABAP角度看SAP货币和汇率
  19. tools1.0.1
  20. 兴业银行银企直连系统开发接口

热门文章

  1. Java字节流输出流FileOutputStream以及流异常处理
  2. 山东省2022年高新技术补助情况
  3. 用Xmanager远程登录AIX图形界面
  4. jaf java_J2EE—JAF和JavaMail
  5. 广西20岁少年黑客盗取200多他人宽带上网账号落网(转)
  6. jQuery版本,以及IE浏览器兼容问题
  7. 从0到1,用Compose搞一个桌面版的天气应用
  8. [数据挖掘工具] R语言书籍的学习路线图(转自格物堂)
  9. 【HTML】企业网站
  10. vsvue文件css提示插件,VSCode 开发Vue必备插件