-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"opam config env" returns cygwin PATH without --sexp and MinGW paths with --sexp #57
Comments
The current behavior was deliberately chosen. The output of The output of You are probably trying to use the emacs build, that is shipped by cygwin.com. However, there is a also a native Windows version of Emacs. The former probably doesn't understand windows paths, the latter won't understand cygwin conventions. Does cygwin's emacs work with a native windows version of merlin? ocamlformat? utop? I can add a switch for easier integration with cygwin based tools, but I'm not sure, if cygwin's emacs is a wise choice and if similar situations will be a common use case. (sexp expressions are not commonly used for such purpose outside the OCaml community) Regarding the strange mixture of forward slashes and backslashes: Variables like |
Many thanks for the detailed explanations! It is indeed a good question if one should use a native Windows or a cygwin emacs. Just FYI: the cygwin emacs does work with the native merlin after patching the emacs config files generated by In general my preferred setup would be one where all build tools are native cygwin applications (say ocamlc, opam, dune, remake, make) and are creating MinGW binaries in a cross compilation sense, similar to the MinGW gcc provided by cygwin. In such a setup a cygwin emacs makes most sense. This would of cause require two ocaml compilers, one for build tools and one for resulting binaries. And in the Coq world possibly a third one which is a MinGW app when one wants to have native compute in Coq. Interestingly ocamlc, opam and dune as created by this opam repo are native Windows apps but still can be used reasonably well as if they would be cygwin apps since they mostly use relative paths. There are only very minor hickups. But since obviously this isn't your working model, it does definitely make sense for me to explore a "as little cygwin as possible" workflow, which would lead to a native Windows Emacs. I am currently in an experimentation phase and am not yet sure what works best. May I ask where - from a design point of view - you draw the line between cygwin and MinGW? What should be cygwin apps and what should be MinGW apps in your opinion? E.g. do you use a cygwin git or a MinGW git? Back to the topic: I think at least for the kind of experiments I am doing, that is shifting around the border between cygwin and MinGW, it would make sense to have a bit more flexibility, and possibly also predictability, in what path format configuration queries to opam return. So something like a --cygwin and --mingw option which would lead to /cygdrive/c/bin and C:/bin results would be most helpful. I fully agree that only in very rarely makes sense to use backward slashes. My comment was more towards "always use forward slashes and don't mix". Still a --windows option, which then returns only backward slashes, also might make sense in some cases. I will follow your advice and see how life with a native Windows Emacs is. |
I've now played around with
Native tools usually have better performance, cygwin gives you greater conformity to Unix standards. The graphical installer will installs cygwin's version of git. But this is just for easier maintenance. Git for Windows is faster, but it ships its own, customized fork of cygwin. You would end up with different version of various tools (git, bash,...) in your PATH. That's a possible source of errors. It's easier to just test everything with one environment. (WSL wouldbe the better choice for many use cases anyway, but WSL is not available for all Windows versions ...). |
Thanks, I will experiment with the new option and try your changes to user-setup and merlin. It is indeed hard to tell in which place this is best fixed. Right now I hack the scripts with patch and sed after creation, which is for sure least elegant and most fragile. I followed your advice and tried the native emacs. It works, but what I don't like is that it installs almost a complete Linux - more than 30.000 files, quite heavy weight even for an advanced editor. It is similar to the MinGW git. As you say, one ends up with 10 Linux like systems on Windows. WSL is definitely an option. What I like about cygwin is that it is lightweight and that I can easily have 10 cygwins for different uses / experiments in parallel on one system. E.g. I tend to have one for development which is quite rich and another one for making releases which is as streamlined as possible to ensure I know what contributes to a release (important to fulfill open source requirements) and also for fast operation in CI. A release build of Coq is always done on a completely fresh cygwin to ensure reproducibility. This is way harder to achieve with WSL (well not that I really tried ...). |
Dear Opam for Windows Team,
opam config env has a strange difference when called with and without --sexp:
MinGW PATH with --sexp
vs cygwin PATH without --sexp
This has the effect that e.g. user-setup for emacs does not work because the opam-user-setup.el file installed by opam user-setup uses the --sexp form and then sets the PATH variable to teh MinGW path after which no command is found any more (all further shell commands return 127).
I would say for this opam living between two worlds, it would be best to have an option if MinGW or cygwin paths are wanted. Depending on the situation both might make sense. As default I would probably use cygwin paths since I guess the intention is that opam is mostly used from cygwin, just the created executables are used from MinGW.
Also not so nice is that \ and / widely mixed and that in the non --sexp case MinGW and cygwin paths are mixed. In woudl recommend to always use / since native Windows APIs do understand /.
Btw.: I am the maintainer of the Coq Windows build (since 4 years or so) and think about switching to your opam for building the official Coq releases for Windows. Currently we use shell scripts which replicate a lot of the information already known to opam. Definitely I want to use it to setup the Coq Windows developer environment and to use development builds of Coq.
The text was updated successfully, but these errors were encountered: