Skip to content
Jason Charney edited this page Jan 31, 2015 · 4 revisions

OCAML or Objective CAML is the main implementation of the CAML (Categorical Abstract Machine Language) Programming language. It more related to Lisp than Perl. OCAML was created by Xavier Leroy.

For our usage, OCAML is required for us to use Haxe which has a version for ARM intended for Raspberry Pi but more than likely will work for ODroid.

Installing OCAML

Much like how installed Ruby using RVM, to install OCAML we need to use OCAMLBrew. And much like gem is used to manage Ruby packages, OPAM does the same with OCAML packages.

TODO: It might be a good idea to cd ~/Software first. Find some way so that it doesn't install in /home/odroid like I foolishly let it.

OCAMLBrew will "bootstrap" a new OCAML environment with OPAM from source without a preinstallation of OCAML or OPAM. (Hopefully this means it will install OCAML and OPAM.) Assuming you have curl and m4 installed (which you probably have), you can get going by typing

curl -kL https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install | env OCAMLBREW_FLAGS="-r -b /opt/ocamlbrew" bash

TODO: REDO THE INSTALLATION INSTRUCTIONS!

Betwen Building Ocaml and Installing Ocaml it's going to take quite a bit of time. So go make a sandwich or do some other business during that time. Ditto for OPAM. So be patient. Go mow the lawn, vacuum the house, or run some errans. Something that will allow you to be productive while this is going on.

All and all, this is what it will look like from start to finish.

$ curl -kL https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install | env OCAMLBREW_FLAGS="-r -b /opt/ocamlbrew" bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   970  100   970    0     0    975      0 --:--:-- --:--:-- --:--:--   975

## Download the latest ocamlbrew

## Starting ocamlbrew
Welcome to ocamlbrew!

Working with http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz
Software will be built and installed under /opt/ocamlbrew/ocaml-4.01.0
Output will be written to /tmp/ocamlbrew.tTCuNw0ZLU
You can "tail -f /tmp/ocamlbrew.tTCuNw0ZLU" in another terminal to track
the build process.

This script is about to:
Install OCaml
and install findlib
and install opam

Retrieving OCaml
Building OCaml
Installing OCaml
Retrieving findlib
Extracting and building findlib
Installing and configuring findlib
Retrieving the latest version of opam
Building opam
Installing opam
Done!

You may want to add the following line to your ~/.bashrc so that OCaml is
readily available to use:

source /opt/ocamlbrew/ocaml-4.01.0/etc/ocamlbrew.bashrc

Enjoy!

## Done.
$

Add source /home/odroid/ocamlbrew/ocaml-4.01.0/etc/ocamlbrew.bashrc to your ~/.bashrc file and you should be ready.

Close the terminal, reopen it then check the status of the following two commands.

echo $TERM
ocaml --version

OCAML should now be part of the path as well as ready to do stuff.

If you just type ocaml you will enter an OCAML interactive shell. It will only close if you press CTRL+D like in Python.

TODO: Show an OCAML example.

See Also

External Links

Clone this wiki locally