esy-issues
esy-issues copied to clipboard
Windows needs some env vars contain semicolon instead of colon as separator
@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.
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.
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.