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

Yotam Barnoy yotambarnoy at gmail.com
Fri May 29 20:19:23 BST 2015


I'll join in thanking you for making this list, Thomas.

I consider this the 2nd most important issue to the health of the OCaml
ecosystem, right after multicore.

Unfortunately, we don't have the feedback of heavy windows users, because
those have been selected out of the OCaml ecosystem. However, looking at
just about every language out there, I think the ultimate goal has to be
first class Windows support. This is my opinion at least. Cygwin is ok for
now, but the aim has to be full windows support if OCaml is going to be
seen as a viable option by the majority of the enterprise crowd. That means
eventually getting rid of every Unix-ism out there, starting with
ocamlbuild and ocamlfind, moving on to opam, and then making a curated list
of packages on opam that build on windows. In fact, we should have a
separate list for packages that build on cygwin, and one for packages that
build on native windows, and we should encourage developers to move towards
the latter list.

As an aside, if you're trying to install cygwin on a windows VM (such as
the ones Microsoft distributes freely) and getting errors, it might have to
do with symlinks. Cygwin has 3 modes of emulating symlinks on windows, and
it can get fooled by the VM into thinking it has low-level support that
isn't really there. All symlinks are then read as regular files, messing up
just about everything. Therefore, before installing cygwin, set the
environment variable CYGWIN to 'winsymlinks:lnk' in the windows environment.

-Yotam

On Fri, May 29, 2015 at 3:00 PM, Török Edwin <edwin+ml-ocaml at etorok.net>
wrote:

> On 05/29/2015 06:10 PM, Thomas Braibant wrote:
> > Hi,
> >
> > 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.)
>
> I don't use Windows myself at all, but I've been recently asked how to
> build an OCaml application on windows.
> Here is my very short experience with OCaml on Windows:
>  - I used WODI with Cygwin64/Cygwin32 and OCaml 4.02.1 due to the large
> number of OCaml and C libraries available (notably Lwt and OpenSSL)
>  - I tried to build my application however it failed due to path errors
> (more on this below)
>  - I tried building opam from git, and it succeeded, although almost any
> package I tried to opam install failed to build
>  - for some reason Cygwin64 executables keep crashing
>  - I gave up after WODI was shutdown, waiting until opam has official
> Windows support
>
> Path errors
> -----------
>
> The errors looked like this, and it took me a while to figure out that
> this is because the build system is Cygwin but ocamlfind is a Win32
> application
> and has no knowledge of what /cygdrive is:
> ocamlfind: Bad configuration: Cannot mkdir
> /cygdrive/c/libre/source/_build/lib/ocaml/site-lib\re because a path
> component does not exist or is not a directory
> File "dynlink_wrapper.ml", line 1, characters 13-14: Illegal character
> (\000)
>
> I worked this around by using `cygpath -m` in my build system in a few
> places, normalizing all paths to use / and replacing symlinks with cp.
>
> The path separators are also mixed (/ vs \, because build system uses / in
> queries like `pwd`, and Filename.concat uses \),  but IIRC this actually
> worked.
> I think native Win32 apps might support a path made all of / these days,
> not sure why we have to go through all the trouble of trying to use \, but
> as a Unix person I probably miss some details here.
>
> Cygwin64 unreliability
> ----------------------
>
> I don't know if the bug is in Windows, Cygwin64 or my VM configuration but
> the build system itself crashes a lot and randomly
> (there seems to be plenty of RAM available).
> Even things like make.exe or rm.exe crash with: segfault, fork: resource
> unavailable, exit code -1073741819.
> Restarting the cygwin shell helps sometimes but the errors are soon back,
> even when using just make -j1.
> The situation was bad enough that I had to repeat the build  4-5 times
> until it finally succeeded as it kept crashing in different places.
> Someone else tried WODI32 and didn't see such errors there, so that seems
> like a more reliable build system.
> Was about to report this as a bug in Cygwin64, but next week WODI was
> shutdown so that ended my Windows testing as well.
>
> Functions not implemented in Unix module
> ----------------------------------------
>
> Although the build system was cygwin I got a native Win32 executable
> apparently, as it failed at runtime as various functions from the Unix
> module are not implemented.
> Luckily this is all well documented, so after adding some conditional code
> I was able to make some progress. Would be better if I could override these
> functions
> with a dummy implementation to make sure I don't get runtime errors.
>
> >
> > - 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).
>
> Is there a way to have the build system and ocamlfind/ocamlopt/ocamlc
> agree on the format of paths?
> (i.e. either both of them are Cygwin or both of them native Win32 apps but
> not a mix)
>
> >
> > - 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.
>
> This seems similar to the Android cross-compilation repository:
> https://github.com/vouillon/opam-windows-repository
>
> Best regards,
> --Edwin
> _______________________________________________
> wg-windows mailing list
> wg-windows at lists.ocaml.org
> http://lists.ocaml.org/listinfo/wg-windows
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-windows/attachments/20150529/abeceb20/attachment.html>


More information about the wg-windows mailing list