Skip to content

Building OCaml

aborkar-ibm edited this page Aug 9, 2022 · 47 revisions

Building OCaml

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

  • RHEL (7.8, 7.9) has 4.05.0
  • RHEL (8.4, 8.6) has 4.07.0
  • RHEL 9.0 has 4.11.1
  • SLES 12 SP5 has 4.03.0
  • SLES (15 SP3, 15 SP4) has 4.05.0
  • Ubuntu 18.04 has 4.05.0
  • Ubuntu 20.04 has 4.08.1
  • Ubuntu 22.04 has 4.13.1

The instructions provided below specify the steps to build OCaml v4.14.0 on Linux on IBM Z for following distributions:

  • RHEL (7.8, 7.9, 8.4, 8.6, 9.0)
  • SLES (12 SP5, 15 SP3, 15 SP4)
  • Ubuntu (18.04, 20.04, 22.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 (7.8, 7.9)

    sudo yum install -y gcc make git awk sed diff
  • RHEL (8.4, 8.6, 9.0)

    sudo yum install -y gcc make git gawk sed diffutils
  • SLES (12 SP5, 15 SP3, 15 SP4)

    sudo zypper install -y gcc make git gawk sed diffutils
  • Ubuntu (18.04, 20.04, 22.04)

    sudo apt-get update
    sudo apt-get -y install gcc make git gawk sed diffutils

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

cd /<source_root>/
git clone https://github.com/ocaml/ocaml.git
cd ocaml
git checkout 4.14.0

Build and Install

1. Configure the build by issuing this command:

./configure --enable-ocamltest

2. Build the bytecode, native-code and fast versions of OCaml compilers:

make

3. Run the test suits (Optional):

make tests

4. Install the OCaml system:

sudo make install

5. Validate installation (Optional):

ocaml --version

The output should be:

The OCaml toplevel, version 4.14.0

References

Clone this wiki locally