I'm trying to compile the hsdis-amd64.dll
library that the JVM needs to disassemble JIT compiled code.
我正在尝试编译hsd -amd64。JVM需要分解JIT编译代码的dll库。
I followed this accepted answer.
我遵从了这个公认的答案。
- I installed cygwin
- 我安装cygwin
- downloaded openjdk-7u40-fcs-src-b43-26_aug_2013.zip
- 下载openjdk-7u40-fcs-src-b43-26_aug_2013.zip
- and downloaded binutils-2.24.tar.gz
- 和下载binutils-2.24.tar.gz
I created a folder structure like this:
我创建了这样一个文件夹结构:
+
+- hsdis // unzipped dir hotspot/src/share/tools/hsdis of openjdk zip
+- binutils-2.24 // unzipped binutils-2.24.tar.gz
First I tried to just compile it using:
首先,我试着用:
$ make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=../binutils-2.24
but it failed with
但是它失败了
/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
hsdis.c:32:20: fatal error: sysdep.h: No such file or directory
#include <sysdep.h>
^
compilation terminated.
So I applied the patch provided in this accepted answer and tried again.
所以我申请了这个被接受的答案,然后再试一次。
The compilation failed again
再次编译失败
In file included from hsdis.c:34:0:
build/Linux-amd64/bfd/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^
I followed the proposal of the compiler and added config.h
just before the errno.h
include.
我遵循编译器和添加配置的建议。就在errno之前。h包括。
Then the error is
错误是
e -I../binutils-2.24/bfd -Ibuild/Linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".dll\" -O hsdis.c -shared build/Linux-amd64/bfd/libbfd.a build/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x15): undefined reference to `compressBound'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x48): undefined reference to `compress'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x28a): undefined reference to `inflateInit_'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2c7): undefined reference to `inflate'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2d6): undefined reference to `inflateReset'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2f1): undefined reference to `inflateEnd'
/usr/lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld: build/Linux-amd64/bfd/libbfd.a(compress.o): bad reloc address 0x0 in section `.pdata'
collect2: error: ld returned 1 exit status
I know that it is a linker problem. For me it seems that it is trying to link against a wrong version, but I might be wrong.
我知道这是一个链接问题。对我来说,它似乎是在试图链接到一个错误的版本,但我可能是错的。
Does anyone knows how to solve this problem or can tell me how to compile the hsdis (HotSpot disassembler plugin)?
有没有人知道如何解决这个问题或者告诉我如何编译hsdis (HotSpot disassembler插件)?
2 个解决方案
#1
2
There is need to add linking against zlib (Be sure that you install package mingw64-x86_64-zlib in cygwin).
需要添加对zlib的链接(请确保在cygwin中安装包mingw64-x86_64-zlib)。
Then open Makefile in editor, find rule:
然后在编辑器中打开Makefile,找到规则:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
Add "-static -lz" to second line to make that:
添加“-静态-lz”到第二行:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) -static -lz
#2
3
The problem could be solved following Marat Buharov's answer.
这个问题可以在Marat Buharov的回答后得到解决。
Nevertheless here are some links where you can find a pre-comiled hsdis plugin:
不过,这里有一些链接,你可以在这里找到一个预合成的hsdis插件:
- http://lafo.ssw.uni-linz.ac.at/hsdis/
- http://lafo.ssw.uni-linz.ac.at/hsdis/
- https://kenai.com/projects/base-hsdis/downloads
- https://kenai.com/projects/base-hsdis/downloads
- http://classparser.blogspot.de/2010/03/hsdis-i386dll.html
- http://classparser.blogspot.de/2010/03/hsdis-i386dll.html
I tried http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64.dll with jdk1.7.0_02 and it worked.
我试着http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64。dll与jdk1.7.0_02一起工作。
#1
2
There is need to add linking against zlib (Be sure that you install package mingw64-x86_64-zlib in cygwin).
需要添加对zlib的链接(请确保在cygwin中安装包mingw64-x86_64-zlib)。
Then open Makefile in editor, find rule:
然后在编辑器中打开Makefile,找到规则:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
Add "-static -lz" to second line to make that:
添加“-静态-lz”到第二行:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) -static -lz
#2
3
The problem could be solved following Marat Buharov's answer.
这个问题可以在Marat Buharov的回答后得到解决。
Nevertheless here are some links where you can find a pre-comiled hsdis plugin:
不过,这里有一些链接,你可以在这里找到一个预合成的hsdis插件:
- http://lafo.ssw.uni-linz.ac.at/hsdis/
- http://lafo.ssw.uni-linz.ac.at/hsdis/
- https://kenai.com/projects/base-hsdis/downloads
- https://kenai.com/projects/base-hsdis/downloads
- http://classparser.blogspot.de/2010/03/hsdis-i386dll.html
- http://classparser.blogspot.de/2010/03/hsdis-i386dll.html
I tried http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64.dll with jdk1.7.0_02 and it worked.
我试着http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64。dll与jdk1.7.0_02一起工作。