Skip to content
Hugo Lafitte edited this page Mar 15, 2016 · 25 revisions

Quick build instructions

Building Opa requires 2 Gb RAM.

OSX

  1. Install homebrew, XQuartz and XCode (and open XCode at least once to accept its license).
  2. Open a terminal and type:
# Dependencies
brew install gnu-sed coreutils ocaml opam nodejs
opam init
eval `opam config env`
opam install ulex camlzip ocamlgraph
sudo ln -s /sbin/md5 /usr/local/bin/md5sum

# Opa
git clone https://github.com/MLstate/opalang
cd opalang
./configure -ocamlfind `which ocamlfind`
make
make install

Modern Linux system

Note that you need OCaml 4.02 or higher to build Opa. Read more about installing OCaml. One option is to run:

# install ocamlbrew
curl -kL https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install | env OCAMLBREW_FLAGS="-r" bash
# As said in the output, run or add the following environment definition:
source ~/ocamlbrew/ocaml-4.02.1/etc/ocamlbrew.bashrc
# Install OCaml dependencies
opam switch 4.02.1
opam install camlp4 ulex camlzip ocamlgraph

# Install other Opa dependencies
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install nodejs make openjdk-7-jre m4 zlib1g-dev unzip git

# Download and compile Opa
git clone https://github.com/MLstate/opalang
cd opalang
./configure
make
sudo make install

Older Ubuntu/Debian systems

If your distribution does not have up-to-date OCaml-related packages, you can use opam. Open a terminal and run:

# Dependencies
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:avsm/ppa
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ocaml camlp4 camlp4-extra opam nodejs make openjdk-7-jre m4 zlib1g-dev unzip git ocaml-findlib

# Install packages with opam
opam init
eval `opam config env`
opam install ulex camlzip ocamlgraph

# Install Opa
git clone https://github.com/MLstate/opalang
cd opalang
./configure -ocamlfind `which ocamlfind`
# workaround a bug in ocamlfind
make && make
sudo make install

Future Linux systems (Ubuntu 15.10)

Open a terminal and run:

# Dependencies
sudo apt-get install ocaml camlp4 camlp4-extra nodejs make openjdk-7-jre m4 zlib1g-dev unzip git ocaml-findlib libocamlgraph-ocaml-dev ocaml-ulex libzip-ocaml-dev pkg-config

sudo apt-get install opam
opam init
opam switch 4.02.1 # === Or higher version
eval `opam config env`
opam install camlp4 ulex camlzip ocamlgraph

# Opa
git clone https://github.com/MLstate/opalang
cd opalang
./configure -ocamlfind `which ocamlfind`
make
sudo make install

Alternative

In case you want to build everything manually, you can use the installation_helper.sh script, which automates the download and installation of Opa dependencies. Try

$ tools/dependencies/installation_helper.sh --help

Building Opa in details

Should you wish to work on an unsupported platform, or to contribute to Opa, you will need to build Opa from sources. This requires a bit more work than the installation, but you should have no major difficulties. You will need:

  • git (to download the source)
  • ocaml 3.12.0-5 or later
  • libgif 4.1 or later (dev version)
  • libjpeg 8b-1 or later (dev version)
  • libpng 1.2.44 or later (dev version)
  • libssl 0.9.8 or later (dev version)
  • libxft 2.2.0 or later (dev version)
  • m4
  • dblatex
  • java 1.5 or later
  • libx11 1.4.2 or later (dev version)
  • zlib 1.2.3.4 or later (dev version)

In addition, if you are using Mac OS X, you will need:

  • GNU coreutils, wget, md5sha1sum and gsed (or gnu-sed) available via MacPorts or Homebrew
  • The Xcode suite, provided by Apple with your copy of Mac OS X (prior to Mac OS X 10.7 Lion).
  • If you do not have Xcode, you can either download Xcode 4 or Xcode 3 (registration required). In addition to general development utilities, this package provides some of the low-level, Mac-specific, tools used by Opa to produce server-side executables.

WARNING:

Starting with Xcode 4.3, Apple does not install command line tools by default anymore, so after Xcode installation, go to Preferences > Downloads > Components > Command Line Tools and click Install. You can also directly download Command Line Tools for Xcode without getting Xcode.

Once these dependencies are satisfied, take the following steps:

  • Grab the sources from GitHub by entering in a terminal:

git clone https://github.com/MLstate/opalang.git

  • In the same terminal, enter
cd opalang
./configure -prefix SOME_DIRECTORY
make all install

(You may need root privileges). This will install Opa in directory SOME_DIRECTORY

Do not forget to change your PATH variable if needed after that.

TIP:

We also provide a script that will help you install all dependencies needed for building Opa. In this case, the only dependencies should be (tested on clean Ubuntu 11.10) :

  • git (to download the source)
  • m4
  • libssl 0.9.8 or later (dev version)
  • zlib 1.2.3.4 or later (dev version)

In your opalang directory, run: tools/dependencies/installation_helper.sh --prefix SOME_DIRECTORY.

You will need to update your PATH variable after that.