[wg-windows] Improving the state of OCaml on Windows

Neuhaeusser, Martin martin.neuhaeusser at siemens.com
Sat May 30 19:43:16 BST 2015

Hi Thomas,

thank you for setting up this list! I really hope that it will help in improving the way Ocaml
can be used on Windows. We are working on some OCaml projects that ultimately need to
be compiled into a Windows-DLL using the MSVC-Toolchain. The development itself is done
entirely on Linux. In particular, we rely on a number of packages on Windows:

-        OCaml 4.02.1

-        Batteries 2.3.1

-        Ocamlgraph 1.8.5

-        Re

-        ZArith 1.2.1  (we failed in building newer versions)

-        Volt (a variant of the Bolt logging library)

-        menhir

-        camlp4

To my experience, compiling the core components (i.e. OCaml, findlib, flexdll, and batteries)
from scratch with MSVC from Visual Studio 2012 within Cygwin, both 32 and 64 bits, is rather
straight-forward and well supported.

Building the other libraries has been rather difficult: Confusion arises when it comes to specifying
search paths when configuring the package builds: Sometimes, one has to specify Unix-like
pathnames. At other times, one has to use Windows pathnames. And the question whether to
use slashes or backslashes, the file extensions and naming conventions, etc. worsen the situation.
Some examples:

·        Menhir gets confused by Windows and Unix-like Pathnames when built on Cygwin.
Hint: You have to specify Windows-Pathnames, but replace any backslashes by slashes
to set the PREFIX in the menhir configuration…

·        The makefile of the regular expression library Re does not correctly handle the .obj
file extension produced on Windows.
Hint: Build Re until it fails; remove the file setup.obj by hand, and build again. Then it

·        Another problem are the paths to the ocaml libraries as reported by ocamlc and ocamlfind.
Sometimes they differ (one reports Unix-pathnames, the other Windows-like paths).
This disturbs the ocamlgraph configuration process. Moreover, we failed in building
ocamlgraph as a shared library.

·        A similar problem related to paths exists in camlp4’s configuration. Resolving it requires
modifications in its myocamlbuild.ml and its install.sh shell script.

·        Building ZArith requires the –mpir and -noasm options and some further hacking in
its configuration file. We only managed to build the older version 1.2.1.

Of course, OPAM on Windows would be great. Offering help to the package maintainers to test their
build system on Windows might help a lot. I will try to file bug reports on the issues that I encountered
when building on Cygwin to the appropriate package maintainers.

Best regards,

Von: wg-windows [mailto:wg-windows-bounces at lists.ocaml.org] Im Auftrag von Thomas Braibant
Gesendet: Freitag, 29. Mai 2015 17:11
An: wg-windows at lists.ocaml.org<mailto:wg-windows at lists.ocaml.org>
Betreff: [wg-windows] Improving the state of OCaml on Windows


Thanks for joining this working group. Its goal is to find out how to improve the state of OCaml and its ecosystem on Windows.

Some of the tasks that we might address (this list is by no mean meant to be exhaustive nor normative):

- Gather information from the community  about the use of the various versions of OCaml available on Windows, and understand what kind of environment people are working with. (BTW, I think a good way to get the discussion rolling might be to describe each other's setup to use OCaml on Windows.)

- Finalize OPAM support for Windows (this is listed on the OPAM 1.3 roadmap). When this support is in place, many OCaml packages should work out of the box (with the proviso that many packages assume a unix-ish environment for their build system).

- Discuss how to help package developers improve Windows support. One way to do that could be to provide know-how about how to setup continuous integration on services like Appveyor to check that packages build on typical Windows setups.

- Find a solution for users of WODI, the GODI based OCaml distribution for Windows, which has been shutdown. WODI was able to compile OCaml related software (using Cygwin as an environment), but was also able to install binary packages. (In some cases, some non-trivial patches  were applied to make package usable on Windows.) Some of the sources needed to use WODI are still available, but the system does not work out of the box now that the server has gone offline. With a little work, we might be able to bring it back, to smooth the transition.

- Discuss the state of cross compilation to Windows.

- Advertise OCamlPro's OCPWin commercial effort. (I will leave Fabrice tell a bit more about that.)

- Discuss how to pool resources (if needed) to work toward these goals.

Many thanks to Anil and OcamlLabs for hosting this mailing list.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-windows/attachments/20150530/c0db58db/attachment-0001.html>

More information about the wg-windows mailing list