Skip to content

Instantly share code, notes, and snippets.

@deadManAlive
Last active March 2, 2025 14:53
Show Gist options
  • Save deadManAlive/c4abbf45c1b556716551e37d601539fc to your computer and use it in GitHub Desktop.
Save deadManAlive/c4abbf45c1b556716551e37d601539fc to your computer and use it in GitHub Desktop.
Installing Ocaml (latest w/o opam) in Windows via MSYS2

Installing OCaml (latest w/o opam) in Windows via MSYS2

  1. Preparation: MSYS2 MinGW64, make sure git, make, diffutils, and gcc installed, e.g. with pacman -S git make diffutils mingw-w64-x86_64-gcc.
  2. git clone https://github.com/ocaml/ocaml.git.
  3. git submodule update --init.
  4. ./configure, then make, and then install with make install.

At this point ocaml, ocamlc, and ocamlopt is already installed on the MSYS2 MinGW64 environment, but you'll hit by error like "Unbound module Stdlib".

  1. Check standard_library location via ocamlc -config, should be /mingw64/lib/ocaml.
  2. Set environment variable CAMLLIB to that location (add export CAMLLIB="/mingw64/lib/ocaml" in ~/.bashrc).
  3. Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment