OCaml for Windows

opam-repository-mingw provides an opam repository for Windows - and an experimental build of opam for Windows. It is work in progress, but it already works well enough to install packages with complex dependencies (like core_kernel) and packages with external dependencies (e.g lablgtk).

The repository is forked from the standard version. It contains Windows specific patches and build instructions. Especially build related tools (ocamlfind, ocamlbuild, omake, oasis, opam and OCaml itself) were modified, so that most unix-centric build instructions will also work with the native Windows/OCaml toolchain and I can sync the repository with the main repo from time to time (and without too much hassle).

The repository and opam itself are intended to be used from within cygwin. Although tools like opam or ocamlbuild are native Windows programs (no runtime dependency on cygwin1.dll), they rely on external tools that are provided by the cygwin distribution (rsync,git,patch,etc.) and won't work without a POSIX emulation layer. The cygwin distribution also ships a version of the GCC compiler (mingw-w64) that will be used internally by the OCaml compiler in order to create native executables and libraries (Cygwin's i686-w64-mingw32-gcc is a cross compiler. The compiler itself depends on cygwin1.dll and posix conventions, but the generated code is independent of cygwin).

Build instructions for the msvc toolchain are also available, e.g. opam switch 4.04+msvc32. However, many packages will only compile with gcc. Packages incompatible with msvc are not marked as such and there is no separate repository that only contains build instructions that are compatible with the msvc toolchain.

Instructions for the initial setup can be found on the Install page.


Note: Esy also supports Windows. If you are not already familar with opam from Linux / OS X and don't want to change your habits, give it a try first.



OCaml 4.11.0

OCaml version 4.11.0 is now available. Some of the highlights in this release are:

  • Statmemprof: a new statistical memory profiler
  • A new instrumented runtime that logs runtime statistics in a standard format
  • A native backend for the RISC-V architecture
  • Improved backtraces that refer to function names
  • Support for recursive and yet unboxed types
  • A quoted extension syntax for ppxs
  • Many quality of life improvements
  • Many bug fixes.

The full list of change can be found in the official announcement thread.

As usually, there are six different switches:

  • 4.11.0+mingw32 / 4.11.0+mingw32c
  • 4.11.0+mingw64 / 4.11.0+mingw64c
  • 4.11.0+msvc32 / 4.11.0+msvc32c
  • 4.11.0+msvc64 / 4.11.0+msvc64c
  • 4.11.0+flambda+mingw32 / 4.11.0+flambda+mingw32c
  • 4.11.0+flambda+mingw64 / 4.11.0+flambda+mingw64c

OCaml 4.10 released

OCaml version 4.10.0 is now available.

Some of the highlights in this release are:

  • A new best-fit allocator for the major heap which reduces both GC cost an memory usage.
  • Some preliminary runtime work for OCaml multicore
  • Immutable strings are now enforced at configuration time
  • User-defined indexing operators for multidimensional arrays
  • Coming soon: statmemprof, a new statistical memory profiler
  • The external API will be release next version
  • Various improvements to the manual
  • More precise exhaustiveness check for GADTs
  • Many bug fixes

Check out the official announcement thread for more details.

As usually, there are six different switches:

  • 4.10.0+mingw32 / 4.10.0+mingw32c
  • 4.10.0+mingw64 / 4.10.0+mingw64c
  • 4.10.0+msvc32 / 4.10.0+msvc32c
  • 4.10.0+msvc64 / 4.10.0+msvc64c
  • 4.10.0+flambda+mingw32 / 4.10.0+flambda+mingw32c
  • 4.10.0+flambda+mingw64 / 4.10.0+flambda+mingw64c

OCaml 4.09.0

OCaml version 4.09.0 is now available. There are six different switches:

  • 4.09.0+mingw32
  • 4.09.0+mingw64
  • 4.09.0+msvc32
  • 4.09.0+msvc64
  • 4.09.0+flambda+mingw32
  • 4.09.0+flambda+mingw64

New OCaml releases are always added to the repository a couple of days after the official release. This page won’t be updated each time :)

opam 2.0

The repository has been upgraded to opam 2.0 format and the installation instructions have been updated for the new opam version.

Upgrading an existing ~/.opam folder is not supported, just rename or delete the directory and let opam create a new one.

OCaml 4.03.0

OCaml version 4.03.0 is now officially supported. There are four different switches:

  • 4.03.0+mingw32
  • 4.03.0+mingw64
  • 4.03.0+flambda+mingw32
  • 4.03.0+flambda+mingw64

You can also install the pre-compiled binaries by adding a suffix-c to the switch, e.g opam switch 4.03.0+mingw64c. Bootstrapping is much faster this way, but the binaries might not work any longer, if the maintainers of the cygwin repository update their mingw64-gcc packages.

First beta of OCaml version 4.03.0

The release of OCaml version 4.03.0 is drawing near. A first beta version was released yesterday.

You can install it with opam switch 4.03.0+beta1+mingw32 or opam switch 4.03.0+beta1+mingw64.

Homepage created

I’ve just activated gh-pages for this repository. The confusing information inside the README.md have been moved to dedicated pages here.

Major changes to the opam builds or the repository will be announced here. Subscribe to the RSS-Feed to stay updated on the developments.