Thursday, December 8, 2011

Compiling the web interface of PPCMEM/ARMMEM just published an article by Paul McKenney introducing PPCMEM/ARMMEM. I downloaded and fixed up the source a bit to make it possible to build the web interface locally and uploaded it on github.

PPCMEM is implemented in Ocaml (the authors are from INRIA and the University of Cambridge) with two user interfaces on top: a curses interface and a web interface. The web interface is implemented by compiling the core Ocaml code into Javascript and adding a bit of hand written Javascript, CSS and HTML. All the heavy computation is done in the browser.

Web interface build dependencies:
Since Fedora doesn't have js_of_ocaml packaged and the ocaml-lwt package it comes with is too old. It's easier to install a separate Ocaml stack:
  1. yum-builddep ocaml-lwt
  2. Install the GODI Ocaml source distribution
  3. Setup a LOCALPATCHES directory for GODI and put this patch-01-libev-2.3.0 under /opt/godi/localpatches/godi/godi-lwt
  4. export PATH=/opt/godi/bin:$PATH
  5. godi_console -> Select godi_jsofcaml -> godi will automatically download and build the dependencies
On a Debian and friends, apt-get install js-of-ocaml should be enough.
Building and launching the web interface:
export JSLIBDIR=/opt/godi/lib/ocaml/pkg-lib/js_of_ocaml
export JSBINDIR=/opt/godi/bin
# to use the js-of-caml packaged on Debian:
# export JSLIBDIR=/usr/lib/ocaml/js_of_ocaml
# export JSBINDIR=/usr/bin
make TARGET=js JSLIBDIR=$JSLIBDIR JSBINDIR=$JSBINDIR depend_js jquery-1.6.1.js js

My modifications to the ppcmem-tarball.tar.gz tarball include:
  1. Retrieved ARM tests under src-arm/ and the missing web UI files url.js, handler.js and help.html from professor Peter Sewell's personal web directory
  2. Wrote a new simple server side component to serve the static files (ppcmem-web)
  3. The original Makefile assumed that js_of_ocaml/ is placed under ppcmem/ (yet doesn't bundle it, which is good ...). I added external js_of_ocaml support in an ugly hack.

Licensing wise, most of the code base in under 3 clause BSD with two modulers lincensed under LGPL plus linking exceptions. So it looks like there's nothing stopping Linux distributions from packaging this.