Skip to content

Instantly share code, notes, and snippets.

@winse
Last active May 11, 2017 06:38
Show Gist options
  • Save winse/3e6b42012dfb228a5b02 to your computer and use it in GitHub Desktop.
Save winse/3e6b42012dfb228a5b02 to your computer and use it in GitHub Desktop.
win32编译openjdk7u60环境变量设置

编译jdk7u60过程中的注意点:

  1. 先看目录下的README-builds.html,不要太认真看个大概就行
  2. 下载最新的Microsoft DirectX SDK,安装时路径不要带括号
  3. 安装procps代替free.exe(检查可用内存是会用到,没有应该也可以就是多个警告而已)
  4. cygwin-make的版本问题,使用3.81 snapshot
  5. VS2010的cl命令显示的信息一直是中文的话,需要修改源码跳过版本号的检查 snapshot
  6. 语言问题,导致编译corba失败!而后面有需要用到这个工程! snapshot
  7. PATH顺序问题,link.exe和find.exe snapshot
  8. 编译时间有点长! snapshot java-version
  9. 默认的make不带调试信息的,需要用make fastdebug_build

步骤:

1、 下载

可以的话,通过cygwin的setup.exe安装mercurial也行。

cd E:
cd git/
mkdir openjdk
cd openjdk/

HG_HOME=/cygdrive/c/Program\ Files/TortoiseHg/
PATH=$PATH:$HG_HOME

hg clone http://hg.openjdk.java.net/jdk7u/jdk7u60/
cd jdk7u60/
ls
./get_source.sh

2、 安装依赖软件

  • jdk1.7.0_02/apache-ant-1.9.0
  • Visual Studio2010
  • Cygwin
    • 按照README-builds.html#cygwin,能找的必须安装,找不到的随意。
    • 安装procps,包括了free.exe。
    • 安装binutils,包括了ar.exe。
    • 替换make.exe, 添加cygintl-3.dll
  • 下载解压freetype
  • 下载安装Microsoft DirectX
    • 安装路径不要带括号

3、 配置环境

  • 切换为英文语言环境,当你重新启动看到的是【Welcome】的时刻说明你修改成功了!重启后记得make clean再进行后面的操作!
  • Windows7安装更新,添加英文语言包
  • 环境变量的所有路径最好是/ 而不是\,不能带双引号(否则中间编译的时刻会遇到问题)snapshot
  • PATH路径顺序的问题,cygwin/bin放在vs的后面,但需要放在windows的前面。link.exe和find.exe的问题

如果是在X64机器上编译,需要加ARCH_DATA_MODEL的参数。参见【README-builds.html#creating】

参考:

# 32为机器
# \ -> /
# replace make.exe and cygintl-3.dll
set PATH=c:/cygwin/bin;%PATH%
set FREETYPE_HOME=C:/cygwin/freetype
set ALT_FREETYPE_HEADERS_PATH=%FREETYPE_HOME%/include
set ALT_FREETYPE_LIB_PATH=%FREETYPE_HOME%/lib
set ALT_DXSDK_PATH=C:/Program Files/Microsoft DirectX SDK
set JAVA7_HOME=D:/Java/jdk1.7.0_02
set ALT_BOOTDIR=%JAVA7_HOME%
set ALT_JDK_IMPORT_PATH=%JAVA7_HOME%
set JAVA_HOME=
rem set ANT_HOME
set WINDOWSSDKDIR=C:/Program Files/Microsoft SDKs/Windows/v7.0A
set VSINSTALLDIR=C:/Program Files/Microsoft Visual Studio 10.0
set PATH=%VSINSTALLDIR%/Common7/Tools;%VSINSTALLDIR%/Common7/IDE;%WINDOWSSDKDIR%/bin;%VSINSTALLDIR%/VC/bin;%VSINSTALLDIR%/VC/vcpackages;%FREETYPE_HOME%/bin;%PATH%
rem # donot add shuangyhao
set INCLUDE=%VSINSTALLDIR%/VC/include;%WINDOWSSDKDIR%/Include;%ALT_FREETYPE_HEADERS_PATH%
set LIB=%VSINSTALLDIR%/VC/lib;%WINDOWSSDKDIR%/lib;%ALT_FREETYPE_LIB_PATH%
echo %PATH%
E:
cd git/openjdk/jdk7u60
make sanity
# 64位机器64为操作系统编译32为的JDK
# 注意事项和32位一样,不过目录结构不同
# shell会复制 dll,同时括号是shell操作符。
cd cygwin
mklink /J freetype "C:/Program Files (x86)/GnuWin32"
set FREETYPE_HOME=C:/cygwin/freetype
set ALT_FREETYPE_HEADERS_PATH=%FREETYPE_HOME%/include
set ALT_FREETYPE_LIB_PATH=%FREETYPE_HOME%/lib
set ALT_DXSDK_PATH=C:/Program Files (x86)/Microsoft DirectX SDK
set JAVA7_HOME=D:/Java/jdk1.7.0_02
set ALT_BOOTDIR=%JAVA7_HOME%
set ALT_JDK_IMPORT_PATH=%JAVA7_HOME%
set JAVA_HOME=
set ANT_HOME=E:/local/usr/share/apache-ant-1.9.0
set WINDOWSSDKDIR=C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A
set VSINSTALLDIR=C:/Program Files (x86)/Microsoft Visual Studio 10.0
set PATH=c:/cygwin/bin;%PATH%
set PATH=%VSINSTALLDIR%/Common7/Tools;%VSINSTALLDIR%/Common7/IDE;%WINDOWSSDKDIR%/bin;%VSINSTALLDIR%/VC/bin;%VSINSTALLDIR%/VC/vcpackages;%FREETYPE_HOME%/bin;%PATH%
rem # donot add shuangyhao
set INCLUDE=%VSINSTALLDIR%/VC/include;%WINDOWSSDKDIR%/Include;%ALT_FREETYPE_HEADERS_PATH%
set LIB=%VSINSTALLDIR%/VC/lib;%WINDOWSSDKDIR%/lib;%ALT_FREETYPE_LIB_PATH%
# @X64
make sanity ARCH_DATA_MODEL=32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment