jordwalke / esy-issues

Easy ISSUES
MIT License
49 stars 5 forks source link

Windows needs some env vars contain semicolon instead of colon as separator #101

Open andreypopp opened 7 years ago

andreypopp commented 7 years ago

@jordwalke writes:

Also, it turns out that OCAMLPATH must be semicolon separated on cygwin! I wonder if there's any other paths for ocaml/findlib that must be semicolon separated on cygwin. I think most of the time, cygwin just allows colon separated . I confirmed that with : ocamlfind wasn't finding the esy built libraries, but with ; it did! We should check CAML_LD_LIBRARY_PATH and OCAML_TOPLEVEL_PATH.

jordwalke commented 7 years ago

It appears this could even be a bug in ocamlfind. In general cyg path env vars should be colon separated. It seems the entire ecosystem has worked around this oddity though - for example merlin knows this quirk and assumes it - so it's probably too late to change. But in the esy eject, we kind of have to know the platform we're ejecting to ahead of time to influence how these are formatted.

jordwalke commented 7 years ago

I was going to suggest just patching ocamlfind to understand the cygwin default (which is colon separated paths), but other tools such as merlin actually anticipate the ocamlfind oddity and look for semicolon separated paths. I fear this is a legacy issue we'll just always have to work around because other tools have adopted it.

For posterity here's the place where Merlin determines path separators: https://github.com/ocaml/merlin/blob/550657b5913072ff7b33e235f7791af5cd0b6a4f/src/kernel/mconfig_dot.ml#L329

Note that if we ever do mingw builds (which is like cygwin but closer to windows native), then we'd have everything configured as semicolons I believe. With cygwin everything is colons, with the exception of the (legacy bug) of OCAMLPATH using semicolons.