Building GrADS under NestedVM from Sources

From OpenGrADS
Revision as of 19:28, 15 November 2009 by Dasilva (Talk | contribs)

Jump to: navigation, search

GrADS/VM is a version of GrADS that runs entirely under the Java Virtual Machine. GrADS/VM is based on the same C source code used in the other versions of GrADS and uses NestedVM for binary translation into Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.

The NestedVM Toolchain

As of this writing the NestedVM developers do not provide binaries for the NestedVM toolchain (gcc, g++, linker, etc). Instructions for building NestVM from sources can be found on their website. We have been using a slightly patched version of a 2008 snapshop built on Mac OS X 10.5 (Leopard). It can be downloaded from the OpenGrADS developer site:

It is recommended that you install this tarball under /usr/local

  % cd /usr/local
  % tar xvfz NestedVM_toolchain-macosx-10.5.tar.gz

If you choose to install the NestedVM tool chain in a separate directory make sure to edit and env.csh in the top directory to reflect this fact.

The Supplibs for NestedVM

A hand built version of the supplibs v2.1.0 have been prepared using the above toolchain on Mac OS X 10.5 (Leopard). It can be downloaded from

Although built on Mac OS X, these supplibs should be portable.

Building GrADS/VM

This instructions have only been tested with the NestedVM toolchain above on Mac OS X 10.5, although in principle in should work on different operating systems. Needles to say, you must have the Java Development Kit (JDK) installed; make sure that commands java, javac and jar are available. The general procedure is to cross-compile GrADS using NestedVM, followed by compilation of supporting Java classes and assembly of a Java Archive (jar). Start by untar-ing the supplibs

% tar xvfz supplibs-2.1.0-nestedvm.tar.gz

This will create a supplibs/ directory. Next, check out GrADS and make symlink for supplibs:

% mkdir gvm
% cd gvm
% gacvs co -P grads
% ln -s ../supplibs/mips-unknown-nestedvm supplibs

This requires OpenGrADS v2.0.a7.oga.3.1 (of 11/15/2009) or later. Assuming you installed the NestedVM toolchain above, prepare your environment

% source /usr/local/NestedVM/


% source /usr/local/NestedVM/env.csh

and cross-compile

% cd grads
% ./configure --host mips
% make

If you are lucky this will create grads and utilities under src/. The next step is to create the Java Archive

% make java-dist

This will create grads-$version.jar in the top directory.

Testing your build

Try running this:

% java -jar grads-2.0.a7.oga.3.1.jar

(replace 2.0.a7.oga.3.1 with whatever version you have.)