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

Alain Frisch alain.frisch at lexifi.com
Mon Jun 1 18:20:23 BST 2015


On 06/01/2015 02:27 PM, Adrien Nader wrote:
> I believe we should focus on cross-compilation to solve that. Currently
> we need a mutant approach because OCaml's build on Cygwin for use
> outside of Cygwin is itself a mutant.
> If we had cross-compilation, we would have one ocamlbuild.exe (for
> instance) that runs as a cygwin executable and one that runs as a native
> windows executable; the former would use POSIX-style paths while the
> latter would use Windows-style paths. There would be a clear distinction
> and no need to have both usable at the same time.

If we are talking about building packages for native ports of OCaml 
(msvc or mingw), in which cases would one need a version of 
ocamlbuild.exe as a cygwin executable?  I'm not familiar with 
ocamlbuild, but I assume that it takes on its command-line typically 
relative paths, not absolute ones, so what would be the purpose of 
supporting POSIX-style paths (when the commands it will run expect 
Windows-style path)?

Ideally, a simple pure OCaml package should be buildable by a simple 
invocation of (native) ocamlbuild.exe without requiring a cygwin 
environment.

> By the way, C:/foo/bar is a perfectly valid Windows paths and avoids
> many troubles with backslashes. Don't fear using forward slashes in paths.

It's valid, but it could create problems with cmd.exe.  And OCaml 
programs tend to use cmd.exe under Windows to run external commands 
(e.g. with Sys.command).

http://stackoverflow.com/questions/10523708/why-does-the-cmd-exe-shell-on-windows-fail-with-paths-using-a-forward-slash

Simply typing in cmd.exe:

   foo/bar.exe

instead of

   foo\bar.exe

fails.  One could argue that to support whitespaces in filenames, one 
should quote the program name anyway, and indeed typing

   "foo/bar.exe"

in cmd.exe works.



Alain


More information about the wg-windows mailing list