Saturday, April 7, 2012

Build a java virtual machine that is actually readable/modifiable for Win32

Is it possible to build a Java virtual machine for Win32 in an sort of understandable way?  It is mostly impossible.  The OpenJDK build will take hours just to build and will take a day to prepare your environment.   If you aren't a core JVM developer, who actually is going to take several days to prep their environment so that they can hack OpenJDK.  The jikes RVM may work with cygwin/win32 but it is mostly designed for linux or some other open platform.  You are really only left with JamVM.  I was actually able to install all of the dependencies with cygwin and perform a build in 15 minutes.  And then actually edit the C source, add a log statement, rebuild and run against a bytecode class file.  JamVM is the only JVM project that is understandable (20-30 core C files) and the build actually works with a modern version of cygwin.

I will go through some of the setup.  It helps to actually install JamVM through cygwin.  Full install.

1. Run cygstart and use cygports as your cygwin repository.  Cygports allows you access to more software packages.

http://sourceware.org/cygwinports/

cygstart -- /cygdrive/c/Users/bbrown/Downloads/setup.exe -K http://cygwinports.org/ports.gpg

2. Select 'jamvm' and run through the installer.

I am installed 'jamvm-1.5.3-5'

3. Run cygstart -- /cygdrive/c/Users/bbrown/Downloads/setup.exe -K http://cygwinports.org/ports.gpg
Again but this time select 'jamvm' source install.  Double click on the text 'Keep' near jamvm.

4.  Change your directory to /usr/src.  The source for jamvm is located in the src directory.

5.  Install jamvm-1.5.3-5 based on the source:

Run cygport ./jamvm-1.5.3-5.cygport all

6.  Then run  cygport ./jamvm-1.5.3-5.cygport prep

7.  Then run  cygport ./jamvm-1.5.3-5.cygport compile

8. Enter '/jamvm-1.5.3-5/build/src'
9. Type 'make' and edit a C source file.

10. javac -source 1.5 -target 1.5 Test.java
11. Run jamvm.exe Test

Dependencies

autoconf2.5-2.65-1+
automake1.10-1.10.3-1+
binutils-2.20.51-2+
cygport-0.9.85-1+
gawk-3.1.7-1+
gcc4-core-4.3.4-3+
libtool-2.2.7a-15+
make-3.81-2+
sed-4.2.1-1+

Some of the dependencies established through jamvm install:


ecj (3.5.2-1)
gnome-icon-theme (3.2.1.2-1)
java-classpath (0.98-2)
java-ecj (3.5.2-1)
libgtk2.0_0 (2.24.10-1)
libjbig2 (2.0-11)
libjpeg8 (8b-1)
libpango1.0_0 (1.29.4-2)
libpng14 (1.4.8-1)
libtiff5 (3.9.4-1)
libXext6 (1.3.0-1)
shared-mime-info (1.0-1)
xcursor-themes (1.0.3-1)


Resources


[1] http://sourceware.org/cygwinports/
[2] http://jamvm.sourceforge.net/  (1.5.3)


No comments: