Download and Installation

This distribution includes the Zélus compiler, runtime libraries, and example source code. The OCaml runtime (ocamlrun) is required to transform Zélus programs into imperative code. The OCaml compiler is required to compile imperative code into executables. Many of the examples require lablgtk2. The 3D visualization of the Sticky Masses example requires glMLite.

The current version of Zélus is 1.2.1 (2016-03-17).


Dependency Required version Reason
OCaml Required. >= 4.02.3 Running the Zélus compiler and compiling examples.
Sundials/ML Optional. >= 2.6.2 Default solver for the “with sundials” distribution.
ocamlfind Optional. >= 1.6.2 Recommended for compiling your own Zélus programs.
lablgtk2 Optional. = 2.18.3 Required for the plotting control and hence many of the examples.
glMLite Optional. >= 0.03.51 Required for the Sticky Masses example.

The compiler is distributed as byte code. It should run on any platform on which the OCaml runtime has been installed. There are packages for Linux, Mac, and Windows. Compiling Zélus programs to executable form requires the full OCaml toolchain. Unfortunately, it may be difficult to run the examples under Windows as the most convenient installer does not seem to provide the dllunix and dllbigarray libraries which are required. We recommend running the examples on Linux or a Mac.


The easiest way to ensure the required dependencies is with a combination of homebrew and opam.

Before installing OCaml, be sure to install XQuartz otherwise OCaml will be installed without the graphics module.

To install the Opam package manager and ocamlfind:

brew install opam
opam install ocamlfind

To install Lablgtk:

brew install pkg-config gtk+
opam install lablgtk
If the second step fails, you may need to first run
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

To install Sundials/ML

brew install homebrew/science/sundials
opam install sundialsml

It is possible to get glMLite to work, but the process is rather complicated.

Ubuntu Linux

To install the Opam package manager and ocamlfind:

sudo apt-get install opam m4
# opam init                 # if this is your first time
opam update && opam upgrade # optionally
opam switch 4.02.3
eval `opam config env`
opam install ocamlfind

To install Lablgtk:

sudo apt-get install libgtk2.0-dev
opam install lablgtk

To install glMLite (optional):

sudo apt-get install freeglut3-dev libjpeg-dev
opam install glMLite

To install Sundials/ML:

sudo apt-get install libsundials-serial-dev
opam install sundialsml

Using the compiler

After downloading the distribution, run the configure script (optionally setting an installation prefix):

./configure --prefix=/usr/local

Zélus can then be installed by running:

sudo make install

The Zélus compiler is called zeluc. It compiles .zls Zélus source files into .ml OCaml source files:

zeluc -i

Adding -v will show results after each of the intermediate source-to-source transformations.

Several dependencies are required to compile the resulting OCaml code. The simplest solution is to use ocamlfind. For example to compile the Bang-Bang Temperature Control example:

zeluc -s main -gtk2
ocamlfind ocamlc -o bangbang -package zelus.gtk -linkpkg

The -s main option generates simulation code for the node called main into the file The -gtk2 option requests the lablgtk runtime.