在64位Windows上编译hsdis
来源:互联网 发布:日本失业率数据 编辑:程序博客网 时间:2024/05/16 08:23
背景
最近想学习下Hotspot的JIT,查找大量资料都说需要hsdis,但是又从哪都找不到windows64位的版本。
如果没有这个东西,直接运行代码,加上如下参数后 -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
会得到如下提示 Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
Could not load hsdis-amd64.dll; library not loadable; PrintAssembly is disabled
。。。。。。
看来确实是需要hsdis-amd64.dll[下载]这个东西的。
动手
无意中翻到了一个网站:How to build hsdis-amd64.dll and hsdis-i386.dll on Windows
内容如下:
How to build hsdis-amd64.dll and hsdis-i386.dll on Windows
- Install Cygwin. At the Select Packages screen, add the following packages (by expanding the Devel category, then clicking once on the Skip label next to each package name):
make
mingw64-x86_64-gcc-core
(only needed for hsdis-amd64.dll)mingw64-i686-gcc-core
(only needed for hsdis-i386.dll)- Run the Cygwin Terminal. This can be done using the Desktop or Start Menu icon created by the installer, and will create your Cygwin home directory (
C:\cygwin\home\username
orC:\cygwin64\home\username
, by default).- Download the latest GNU binutils source package and extract its contents to your Cygwin home directory. At the time of writing, the latest package is
binutils-2.24.tar.bz2
. This should result in a directory named binutils-2.24 (or whatever the latest version is) in your Cygwin home directory.- Download the OpenJDK source by going to the JDK 8 Updates repository, selecting the tag corresponding to your installed JRE version, and clicking bz2. Extract the hsdis directory (found in src\share\tools) to your Cygwin home directory.
- In the Cygwin Terminal, enter
cd hsdis
.- To build hsdis-amd64.dll, enter
make OS=Linux MINGW=x86_64-w64-mingw32 'AR=$(MINGW)-ar' BINUTILS=~/binutils-2.24
. To build hsdis-i386.dll, entermake OS=Linux MINGW=i686-w64-mingw32 'AR=$(MINGW)-ar' BINUTILS=~/binutils-2.24
. In either case, replace2.24
with the binutils version you downloaded.The DLL can now be installed by copying it from hsdis\build\Linux-amd64 or hsdis\build\Linux-i586 to your JRE’s bin\server or bin\client directory.
Note that binutils and OpenJDK use incompatible licenses. As I understand it, this means that it is legal to combine them for personal use, but not to distribute the result. Because of this, I cannot provide prebuilt DLLs.
Bonus tip: if you prefer Intel ASM syntax to AT&T, specify
-XX:PrintAssemblyOptions=intel
alongside any other PrintAssembly options you use.
大体上按照这个做完之后,最后执行make命令总是报错。
踩了不少坑,最后还是build出来了。
现在在上面引用内容的基础上进行完善,希望能帮助更多人
请参照下面的步骤
粗体的部分是在上文基础上更新的内容
- 准备
- 下载Cygwin安装包(Windows 64位版本)
- 下载GNU binutils
- 下载OpenJDK源码
- 安装Cygwin
- 镜像我使用的网易的,http://mirrors.163.com/,下载600KB/s,带宽高应该更快
Select Packages
页面需要注意,在默认的基础上,需要额外安装的package有:- Devel - make
- Devel - gcc-core
- Devel - mingw64-x86_64-gcc-core
- Devel - texinfo
- Utils - diffutils
- 安装完之后启动Cygwin,则会在Cygwin的安装目录下的
home
下自动生成你的用户名命名的文件夹(下文记之为~
) - 将下载的binutils解压到
~
下.../home/用户名/binutils-2.27/
- 将下载的openJDK源码/src/share/tools/hsdis解压到
~
下.../home/用户名/hsdis/
- 修改
~/hsdis/Makefile
文件,搜索LIBRARIES
,将LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
$(TARGET_DIR)/opcodes/libopcodes.a \
$(TARGET_DIR)/libiberty/libiberty.a
修改为LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
$(TARGET_DIR)/zlib/libz.a \
$(TARGET_DIR)/opcodes/libopcodes.a \
$(TARGET_DIR)/libiberty/libiberty.a
保存 - 在Cygwin窗口输入
cd ~/hsdis
,然后输入命令make OS=Linux MINGW=x86_64-w64-mingw32 'AR=$(MINGW)-ar' BINUTILS=~/binutils-2.27
(最后的binutils路径需要与实际安装路径一致) - 等待几分钟,如果最后没有报错,那么就build成功了,我们需要的
hsdis-amd64.dll
现在就在~/hsdis/build/Linux-amd64
里面了,把它copy到$JAVA_HOME/jre/bin/server
(或$JAVA_HOME/jre/bin/client
)下就OK了。
- 在64位Windows上编译hsdis
- 在windows上编译32位和64位mono
- 在Windows上使用CMake编译64位dll
- 如何在Windows上编译64位QT
- Access 数据库 在64位的windows运行时,需要在编译时,编译为x86结构,既可以在32位64位的操作系统上运行
- hadoop入门-在windows上编译x64位hadoop
- 在Windows 7 上为VS2012编译boost 1.55 64位库
- 在Windows 7 上为VS2012编译boost 1.55 64位库
- 在64位linux上编译32位程序
- 自己动手编译hsdis
- 在64位Windows上运行32位应用程序[iis]
- 在32位WINDOWS系统上开发64位应用程序
- Windows 7-64位上编译webkit源码纪实
- .net 编译时选择anycpu x86 x64的区别: 在 64 位 Windows 操作系统上: 用 x86 编译的程序集将在 WOW64 下运行的 32 位 CLR 上执行。 用 x64 编译
- VS2008/2010在64位Windows平台上编译ArcEngine导致HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)错误的解决办法。
- VS2008在64位Windows平台上编译ArcEngine导致HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)错误的解决办法。
- 在Ubuntu12.04 64位上编译hadoop2.2.0
- 在CentOS 64 位系统上编译Hadoop 2.2.0
- eclipse启动时发生的Initializing Java Tooling错误
- linux应用编程笔记(1)gdb调试方法及如何找出dbg.c程序中的错误
- FPGA信号的截位问题
- 关于磁珠在PCB应用中你不得不知道的这几点
- SQL Server 扩展事件(Extented Events)从入门到进阶(2)——在GUI中创建基础扩展事件
- 在64位Windows上编译hsdis
- 伽马空间与线性空间
- 欢迎使用CSDN-markdown编辑器
- plsql不配置tns直接连接oracle
- 集合(6-Lookup)
- wxwidgets:用指令来编译VS的solution
- codeforces 508D (无向图欧拉路径)
- pNFS概述
- 初始html5