Installation and Configuration Guide

Prerequisite Packages

Beluga requires the following packages, regardless of operating system. We recommend installing lrwrap to improve performance in Interactive mode.

MAC OS

All of the prerequisite packages are available through OPAM for OCaml. Please visit their website for the details.

Linux

Under Debian Linux, all the necessary prerequisites can be installed with just the following command:

# apt-get install ocaml ocaml-findlib libextlib-ocaml-dev ocaml-ulex

The interactive mode is greatly improved if you have rlwrap installed, so you might also want to consider:

# apt-get install ocaml ocaml-findlib libextlib-ocaml-dev ocaml-ulex

These commands may work under other distributions. The packages are also available through OPAM for OCaml

Microsoft Windows

Beluga can be executed on Windows through Cygwin. The necessary prerequisites can be installed using an OCalm package manager called WODI.

  1. Download the WODI graphical installer wodi32/64.exe
  2. Run wodi32/64.exe and step through the installation wizard
  3. From the start menu, select Wodi32/64 Package Manager. Don't be alarmed if WODI cannot read all PATH entries.
  4. Search for each of the prerequisite packages: extlib, ulex, ounit, findlib. Check the box beside each of the packages and click "Apply". The checkbox will be greyed out if the package has already been installed.

Building

Compile by running make from the Beluga directory:

~/beluga# make

Compilation Options

Setting the following environment variables for make enables the following compilation option:

BYTE:
sets byte-code compilation instead of native
DEBUG:
enables the -g option of ocamlc
PROFILE:
enables the -p option of ocamlc
WARN_PATTERN:
enables warning for non-exhaustive patterns
VERBOSE:
sets verbosity level of ocamlbuild
PARALLEL:
sets max number of parallel processes

For instance, to enable byte-code compilation, run:

~/beluga# make BYTE=true

Troubleshooting

Attempting to build Beluga before installing the prequisites may cause libraries to be only partially updated. You may receive a new error message once you've set up the prereq packages.

Error: The files [path/to/file]
        and [path/to/file]
        make inconsistent assumptions over interface [library name]

Try cleaning the Beluga directory.

~/beluga# make clean all

Executing Programs

Once you've built the Beluga executables, you can now run Beluga programs with the ./beluga/bin/beluga" executable.

~/beluga# bin/beluga path/to/program.bel

Emacs Mode

Beluga includes a major mode for programming in Emacs. The elisp file saved as ./beluga/tools/beluga-mode.el directory.

  1. Update your ~/.emacs configuration file with the lines written below. XEmacs users must update ~/.xemacs and ~/.xema.cs/init.el with the same text. Create any of these files if they do not exist already.
    (add-to-list 'load-path "path/to/beluga/tools/")
    (load "beluga-mode.el")

  2. Add beluga/bin to your path; if Emacs does not detect your custom path, a quick fix is to create a symbolic link to the Beluga executable in a directory that is in the default Emacs path (such as /usr/bin).
  3. Restart Emacs.

Emacs will now launch Beluga-mode automatically when you open a program with the .bel suffix.