Apr 29, 2007

How to build Tamarin on Windows

The Tamarin project is an open source ECMAScript Virtual Machine, contributed by Adobe to the Mozilla fondation.
This VM is already running inside the Flash player 9, and is planed later to be integrated in SpiderMonkey (the engine running JavaScript in Mozilla, FireFox, etc.).
Here I gonna explain step by step how to compile it under Windows (win32).

01. Download a C++ compiler
I set my choice on Visual C++ 2005 Express Edition, first because if you're new to compiling on windows this is less hassle to set up, second it's free to use and third it can build Windows native executable and it's what we want here.

Download and Install vcsetup.exe (3MB), and don't forget to register (well yaknow that MS thing, don't worry it's free).

Well now you will have to install the Platform SDK (well I said "less hassle", not "no hassle"), you need the PSDK for thing like windows.h, but anyway as you're into compiling in C/C++ having the PSDK could be usefull later, whatch out it can be a big download (around 300MB and more).

But basically follow these steps:
Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK.

02. Download Tamarin sources from the CVS repository
You gonna need CVS, simpler thing to do is to install TortoiseCVS, and then add the path to the TortoiseCVS install to your environment variables.

That way you will be able to use CVS from the command line, and use the following to get Tamarin sources.

cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot
 export -r HEAD mozilla/js/tamarin
To compile Tamarin you will also need the zlib module, that you can get also from CVS.
cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot
 export -r HEAD mozilla/modules/zlib
You should write these all in one line, you can download that zip file for some little batch files that will do that for you ;).


03. Compiling Tamarin with VC++ express
After the CVS checkout you should have the Tamarin directories all set up, now we need to open avmplus_8.vcproj.
Now, right click solution 'avmplus_8' and select build solution.

If all went OK, you should obtain this line at the end.
========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
By default the project compile the debugger version of avmplus, that can be found here.
..mozilla\js\tamarin\platform\win32\obj_8\shell\Debug_Debugger\avmplus_sd.exe
Here the options for the avmplus (debugger).
--------------------------------------------------------------
avmplus shell 1.0 build d684

usage: avmplus
          [-d]          enter debugger on start
          [-Ddprofile]  dynamic instruction stats
          [-Dsprofile]  show static instruction stats
          [-Dgreedy]    collect before every allocation
          [-Dnogc]      don't collect
          [-Dgcstats]   generate statistics on gc
          [-Dnoincgc]   don't use incremental collection
          [-Dastrace N] display AS execution information, where N is [1..4]
          [-Dinterp]    do not generate machine code, interpret instead
          [-Dverbose]   trace every instruction (verbose!)
          [-Dbbgraph]   output MIR basic block graphs for use with Graphviz
          [-Dforcemir]  use MIR always, never interp
          [-Dnodce]     disable DCE optimization
          [-Dnocse]     disable CSE optimization
          [-Dnosse]     use FPU stack instead of SSE2 instructions
          [-Dverifyall] verify greedily instead of lazily
          [-Dtimeout]   enforce maximum 15 seconds execution
          [-error]      crash opens debug dialog, instead of dumping
          [-log]
          [-- args]     args passed to AS3 program
          [-jargs ... ;] args passed to Java runtime
          filename.abc ...
          [--] application args
--------------------------------------------------------------


04. Compile the Release version of Tamarin
Right click solution 'avmplus_8' and select configuration manager....

At the top left in active solution configuration, select Release, close the window, clear the output (right click clear all), and compile again.

Again if all goes well you should obtain this line at the end.
========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
The compiled exe can be found here
..mozilla\js\tamarin\platform\win32\obj_8\shell\Release\avmplus.exe
Here the option for the avmplus (release).
--------------------------------------------------------------
avmplus shell 1.0 build d684

usage: avmplus
          [-Dinterp]    do not generate machine code, interpret instead
          [-Dforcemir]  use MIR always, never interp
          [-Dnodce]     disable DCE optimization
          [-Dnocse]     disable CSE optimization
          [-Dnosse]     use FPU stack instead of SSE2 instructions
          [-Dtimeout]   enforce maximum 15 seconds execution
          [-error]      crash opens debug dialog, instead of dumping
          [-log]
          [-- args]     args passed to AS3 program
          [-jargs ... ;] args passed to Java runtime
          filename.abc ...
          [--] application args
--------------------------------------------------------------


Voila, you should now be able to compile Tamarin on Win32 :).
The next post will be about how to use that's shiny avmplus to compile ECMAScript 4 source.

1 comment

  1. Can you share anywhere binaries for win32 by any chance? ;)