Building OCaml - linux-on-ibm-z/docs GitHub Wiki
Building OCaml
Below versions of OCaml are available in respective distributions at the time of creation of these build instructions:
- RHEL 8.10 has
4.07.0 - RHEL (9.6, 9.7, 9.8) have
4.11.1 - RHEL (10.0, 10.1, 10.2) have
5.2.0 - SLES (15 SP7, 16) have
4.14.2 - Ubuntu 22.04 has
4.13.1 - Ubuntu 24.04 has
4.14.1
The instructions provided below specify the steps to build OCaml version 5.5.1 on Linux on IBM Z for following distributions:
- RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
- SLES (15.7, 16.0)
- Ubuntu (22.04, 24.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.
1. Install Dependencies
export SOURCE_ROOT=/<source_root>/
1.1. Ensure that GCC and GNU make are installed and up to date:
-
RHEL (8.10)
sudo yum install -y gcc make git gawk sed diffutils -
RHEL (9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
sudo yum install -y gcc gcc-c++ make git gawk sed diffutils binutils hostname tar unzip cmake curl wget vim patch tcl gettext autoconf libtool automake bzip2 zlib zlib-devel bison -
SLES (15 SP7, 16)
sudo zypper install -y gcc make git gawk sed diffutils -
Ubuntu (22.04, 24.04)
sudo apt-get update sudo apt-get -y install gcc make libc6-dev git gawk sed diffutils
2. Build and Install
2.1. Download the OCaml source and navigate into the top-level directory:
cd $SOURCE_ROOT
git clone -b 5.5.1 https://github.com/ocaml/ocaml.git
cd ocaml
2.2. Configure the build by issuing this command:
./configure --enable-ocamltest
2.3. Build the bytecode, native-code and fast versions of OCaml compilers:
make
2.4. Install the OCaml system:
sudo make install
3. Run the test suites (Optional):
make tests
4. Validate installation (Optional):
ocaml --version