Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

OCaml Legacy Building Patches for Windows

This repository contains patches necessary for compiling the native Windows versions of OCaml from 3.07 onwards.

Additionally, a couple of utility shell scripts are provided for doing bulk-builds and applying the patches. In order for these scripts to function correctly, the tarballs for the required version(s) of OCaml must be downloaded from Inria (and also the two official .diffs patch files for OCaml 3.07+1 and 3.07+2).


config-option (OCaml 3.07--3.08.4): back-ports the -config option added in 3.09.0. The patch is compatible with GPR465 and uses the identifier config-option.

win32-graph (OCaml 3.08.4): back-ports commit 7a7a87 from 3.09.0, fixing the graphics library for Windows.

The following relate to GitHub Pull Requests and Mantis PRs:

GPR465 (OCaml 3.07--): adds a patches to the output of ocamlc -config for noting changes to the compiler. The patches themselves are from the pull request. The patch combines with the config-option patch to support 3.07 and 3.08 as well.

GPR582 (OCaml 4.03.0): back-ports cfb03b fixing installation of .cmx files for the systhreads library.

GPR658 (OCaml 3.07--): ensures that paths are always displayed using backslashes (from ocamlc -config, camlp4 -where and ocamlbuild -where).

GPR678 (OCaml 3.08.0--): correctly fixes PR3963 which, for 4.01.0 onwards means that Graphics.close_graph doesn't crash the 64-bit runtime and for all versions means that calls to Graphics.wait_next_event are unblocked by closing the graphics Window.

PR4575 (OCaml 3.10.x): back-ports a fix to the output of ocamlbuild -where as a \r character was included in the output.

PR4683 (OCaml 3.11.x): back-ports commit 27e0b7 from 3.12.0 installing labltk.bat instead of a bash script.

PR4847 (OCaml 3.10.0--3.11.1): back-ports commits f98e29 and a795c5 to ocamlc -output-obj for msvc64.

PR5331 (OCaml 3.12.1): back-ports commit 6b6e39 fixing the installation of ocamlmktop without the .exe extension on Windows.

PR6766 (OCaml 3.12.0--4.02.3): back-ports commit b014f2 fixing an intermittent crash when using systhreads.

PR6797 (OCaml 4.02.2--4.02.3): back-ports commit 44b8b5 fixing the -output-complete-obj option for the Microsoft C compiler ports.


The following patches address build system or environment changes which have occurred since these versions of OCaml were originally released:

cc-profile (OCaml 3.07--3.10.2): CC_PROFILE was not substituted when building utils/ resulting in harmless, though invalid, output in ocamlc -config.

debugtype (OCaml 3.07--3.09.3): back-ports commits ac86cc and 536dfe to remove the /debugtype:cv which ceased to be support in Visual Studio .NET 2002.

mingw (OCaml 3.07--3.12.1): config/Makefile.mingw used the old -mno-cygin method of invoking the MinGW version of GCC, which is no longer support in Cygwin.

msvc (OCaml 3.07--3.09.3): config/Makefile.msvc uses the Cygwin ld, nm and objcopy commands. This optional patch switches them to use the i686-w64-mingw32- prefixed versions instead.

msvc64 (OCaml 3.10.x and 3.11.x): config/Makefile.msvc includes a library only required in the pre-release version of the 64-bit Windows SDK.

ocamldoc-3.07 (OCaml 3.07): missing spaces in ocamldoc/Makefile.nt (it's actually not clear how this ever functioned, even in an old version of make!).

ocamldoc-build (OCaml 3.07--4.00.1): fixes a build system problem caused by various French accents in ocamldoc (a concerted effort was made to eliminate encoding problems prior to OCaml 4.01.0).

output-obj (OCaml 3.07): back-ports a small part of e2b313 which suppresses a warning emitted by GCC for ocamlc -output-obj

tcl-tk-amd64 (OCaml 3.10.x--4.01.0): at the time of the release of 64-bit OCaml for Windows (using the Microsoft C Compiler for 3.10.0 and also GCC for 4.00.0) there was not a readily available 64-bit distribution of Tcl/Tk for Windows, so labltk was disabled for these ports. However, it has always worked and these patches enable the build system to build the 64-bit labltk for all versions.

win-runtimed (OCaml 3.11.0--4.02.1): back-ports commit 615472 which fixes the output filename when compiling the debug runtime.

The following patches relate to GitHub Pull Requests and Mantis PRs:

GPR405 (OCaml 3.07--4.02.3): enables compilation of the MSVC ports with Visual Studio 2015.

GPR820 (OCaml 4.00.0--): fixes various issues with compilation of the debugging version of the bytecode runtime. The is probably necessary for versions prior to 4.00, but those versions will also need the machinery for -with-debug-runtime to be back-ported (at present, that's not considered necessary).

GPR912 (OCaml 4.04.0): back-ports a fix to Unix.create_process causing segfaults in the 64-bit MSVC port on Windows 10.

PR3485 (OCaml 3.07--3.08.2): back-ports a Cygwin-related change made in OCaml 3.08.3.

PR3821 (OCaml 3.07--3.09.3): back-ports the rest of 536dfe to add /subsystem:console option for all invocations of the Microsoft C compiler added in 3.10.0. This is necessary to enable building with Visual Studio 2015.

PR4483 (OCaml 3.10.1): back-ports commit fd07b4 from OCaml 3.10.2 converting byterun/finalise.c back to ANSI C.

PR4614 (OCaml 3.07--3.10.x): back-ports commits ad3ca0 and ff88bb to allow building with Tcl/Tk 8.5 to OCaml 3.11.0 when support was officially added.

PR4700 (OCaml 3.07--4.01.0): disables the tkanim library when building with Tcl/Tk 8.5 or later.

PR5011 (OCaml 3.07--4.00.x): back-ports changes introduced in OCaml 4.01.0 to support Tcl/Tk 8.6.

PR5477 (OCaml 3.07--3.12.1): back-ports detection of libX11 using pkg-config from OCaml 4.00.0.

Copyright and are copyright MetaStack Solutions Ltd., 2016 and distributed under the terms of the licence given at the top of each file.

Patches above described as back-ports represent work already in the OCaml repository. The changes made in these patches are the copyrights of their respective authors and are distributed under the terms of the GNU Lesser Public Licence version 2.1 (see the file LICENSE in the OCaml repository).

All other patches are the work of David Allsopp and are released under the Creative Commons CC0 1.0 Universal licence.


Patches for building old versions of OCaml on modern Windows installations






No releases published


No packages published