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

Alain Frisch alain.frisch at lexifi.com
Tue Jun 2 09:01:42 BST 2015


On 06/01/2015 08:32 PM, Adrien Nader wrote:
> Yes, the best case would be an ocaml tool (ocamlbuild, assemblage,
> omake, that's not the question) that does everything without relying on
> the host posixness.
>
> However I do not expect this to be doable for all the cases, current or
> future. If the build system runs mt (control magnetic tape drive
> operation: autoconf sometimes check for it :)) through a direct command
> invocation, then it will need a posix host. My 'mt' example was a bit
> silly but it's very very common to see shell scripts used in build
> system hooks. Such things will always happen. For these we will always
> need a posix environment.

I completely agree.  But in my experience, using omake (as a native 
non-cywin application) works well even if it needs to call cygwin tools 
(e.g. "zip") -- perhaps because it relies on relative paths -- and I 
expect something similar to be achievable by ocamlbuild.  I understand 
your point that jumping from cygwin realm to "native" back and forth is 
not ideal, but providing Cygwin + native versions of all build tools 
would also be confusing.

Do you see concrete cases where using a cygwin ocamlbuild.exe to drive 
the compilation with a native port of OCaml would be useful?


> As for relative paths and ocamlbuild, I'm not even sure about that but
> paths are only a small part of the issue; maybe we could avoid that but
> it's a never-ending fight. I would rather tell people: "If it uses
> ocamlbuild, omake, assemblage or jenga, you can build it directly;
> otherwise you need Cygwin." and have builds for cygwin easy to setup.

Even with omake, of course it depends on what rules do.  For ocamlbuild, 
one could at least try to enforce this property when there is no custom 
myocamlbuild.ml in the project.


> This applies to cmd.exe but the use of cmd.exe should be banned
> altogether. Calls to Sys.command are done with a POSIX shell in mind.
> This is precisely why ocamlbuild depends on bash.exe from cygwin or
> msys: to interpret posix shell command-line and escapes. Noone will
> learn and apply the syntax rules of cmd.exe: the only solution is to
> have APIs based on string array at the OCaml level and implement the
> escape rules properly (Windows' CreateProcess() takes a string argument,
> not a string array one: it's needed if not using cmd.exe).

Does one need a new API, or fix Unix.create_process and co?

Do you know why ocamlbuild uses bash instead of Unix to run external 
commands?


Alain


More information about the wg-windows mailing list