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.

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.