Skip to content

Building OCaml

aborkar-ibm edited this page Aug 28, 2019 · 47 revisions

Building OCaml

Below versions of OCaml are available in respective distributions at the time of creation of these build instructions:

  • RHEL (7.5, 7.6, 7.7) have 4.05.0
  • SLES 12 SP4 has 4.03.0
  • SLES (15, 15 SP1) has 4.05.0
  • Ubuntu 16.04 has 4.02.3
  • Ubuntu (18.04, 19.04) has 4.05.0

OCaml is a popular object-oriented functional programming language. The OCaml system contains an interpreter as well as a compiler (that compiles OCaml source to machine code). The instructions provided below specify the steps to build OCaml 4.08.1 on Linux on IBM Z for following distributions:

  • RHEL (6.10, 7.5, 7.6, 7.7, 8.0)
  • SLES (12 SP4, 15, 15 SP1)
  • Ubuntu (16.04, 18.04, 19.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Pre-requisites

1. Ensure that GCC and GNU make are installed and up to date:

  • RHEL (6.10, 7.5, 7.6, 7.7, 8.0)

    sudo yum install -y gcc make git
  • SLES (12 SP4, 15, 15 SP1)

    sudo zypper install -y gcc make git awk
  • Ubuntu (16.04, 18.04, 19.04)

    sudo apt-get update
    sudo apt-get -y install gcc make git

2. Download the OCaml source and navigate into the top-level directory:

git clone git://github.com/ocaml/ocaml.git
cd ocaml
git checkout 4.08.1

Building and Installation

1. Configure the build by issuing this command:

./configure

2. Build the OCaml bytecode compiler:

make world

3. Build the native-code compiler, then use it to compile fast versions of the OCaml compilers:

make opt
make opt.opt

4. Install the OCaml system:

umask 022
sudo make install

References

http://ocaml.org
http://caml.inria.fr/ocaml/release.en.html

Clone this wiki locally