jvm编译环境搭建 win Vc篇

/**************************************************************
技术博客
http://www.cnblogs.com/itdef/
 
技术交流群
群号码:324164944
 
欢迎c c++ windows驱动爱好者 服务器程序员沟通交流
**************************************************************/

 

win7英文(推荐)

下载JDK7

http://download.java.net/openjdk/jdk6

http://download.java.net/openjdk/jdk7(推荐)

http://download.java.net/openjdk/jdk8

下载visualstudio

社区版本 2015(建议使用2010版本)

下载cygwin

cygwin.com

微软下载SDK7.1

Microsoft windows sdk for windows7 and .net framework

ecilipse IDE java developer 版本 eclipse-java-kepler-SR2-win32

 

所有安装路径不要带空格带中文

C:\Program Files\Microsoft Visual Studio 12.0

这样的默认路径要修改

操作系统使用win7 32位版本

首先安装vs2010 

然后安装JDK7 进行路径设置(JAVA_HOME CLASSPATH)

安装 sdk7.1

 安装cygwin

安装的时候 将以下库勾选

 

Binary Name Category Package Description
ar.exe Devel binutils The GNU assembler, linker and binary utilities
make.exe Devel make The GNU version of the 'make' utility built for CYGWIN.
NOTE: See the GNU make section
m4.exe Interpreters m4 GNU implementation of the traditional Unix macro processor
cpio.exe Utils cpio A program to manage archives of files
gawk.exe Utils awk Pattern-directed scanning and processing language
file.exe Utils file Determines file type using 'magic' numbers
zip.exe Archive zip Package and compress (archive) files
unzip.exe Archive unzip Extract compressed files in a ZIP archive
free.exe System procps Display amount of free and used memory in the system

配置CYGWIN BIN 路径  C:\OpenJDKBuild\cygwin\bin

配置VC BIN 路径  C:\OpenJDKBuild\VS2010\VC\bin

命令行执行cl.exe时候

提示缺少mspdb100.dll

经过搜索 发现该文件在目录 C:\OpenJDKBuild\VS2010\Common7\IDE

将这个路径也配置到 path环境变量中

 

我的PATH变量设置如下 

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\xxx>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\OpenJDKBuild\jdk1.7.0_80\bin;C:\OpenJDKBuild\jdk1.7.
0_80\jre\bin;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\OpenJDKB
uild\cygwin\bin;C:\OpenJDKBuild\VS2010\VC\bin;C:\OpenJDKBuild\VS2010\Common7\IDE

《深入理解Java虚拟机 JVM高级特性与最佳实践》一书还特别提到 需要将vs2010的BIN路径放到CYGWIN的BIN路径前面。不过我没这么做  也成功了.

 

环境配置完成 着手编译

开启命令行

进入openjdk\hotspot\make\windows 目录下

执行 VC TOOL 目录下的vsvars32.bat

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\xxx>cd C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows

C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows>C:\OpenJDKBuild\V
S2010\Common7\Tools\vsvars32.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

接着 执行命令 create(jdk目录)

C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows>create C:\OpenJDK
Build\jdk1.7.0_80
**************************************************************
Will generate VC10 {Visual Studio 2010}
C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\build\vs-i486\jvm.vcxproj
**************************************************************
NOTE: Using the following settings:
HotSpotWorkSpace=C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\
HotSpotBuildSpace=C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\build\vs-i
486
HotSpotJDKDist=C:\OpenJDKBuild\jdk1.7.0_80
-- compiler1 --
-- compiler2 --
-- tiered --

然后VC的SLN文件便生成 就可以在VC中编译了

但是该VC工程可能生成的预编译配置 过了“号 需要去掉

如图

最后编译成功

 代码面前了无秘密  配合书籍文档 对于运行机制会有更深入的理解

posted on 2016-10-24 22:15  itdef  阅读(322)  评论(0编辑  收藏  举报

导航