opam
opam copied to clipboard
Incorrect message on windows for updating environment vars
On windows, I get a message to run eval $(opam env). E.g.:
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build coq-core 8.19.2
+-
- No changes have been performed
# Run eval $(opam env) to update the current shell environment
If I do, my $PATH is totally messed up and opam is no longer in the path.
Instead, it seems I should be using the command provided in a blog post here:
https://opam.ocaml.org/blog/opam-2-2-0-windows/
On second inspection, It seems that this only happens in my mingw shell, in powershell I get the correct command.
But either way running eval $(opam env) in the mingw shell does not produce the correct results.
Can you share the output of opam env in your mingw shell?
Indeed, if you're running opam from within Cygwin/MSYS2, etc. (i.e. bash or some such) then the command suggested is correct and it is supposed to work!
Can you share the output of
opam envin your mingw shell?
I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with /cygdrive/c/... or /cygdrive/d/..., e.g.,
...:/cygdrive/d/Program Files/Git/usr/bin/core_perl
while my working PATH has it as
...:/usr/bin/core_perl
I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with
/cygdrive/c/...or/cygdrive/d/...
both should be equivalent in a cygwin context so i'm not sure why that would break things. Are you using MSYS2, an existing Cygwin installation or the recommended internal Cygwin installation?
...:/cygdrive/d/Program Files/Git/usr/bin/core_perlwhile my working PATH has it as
...:/usr/bin/core_perl
This part is pretty surprising though, are you sure this is verbatim what's in your PATH?
If so, opam is introducing the Git for Windows path without a separator (it should at least be ...:/cygdrive/d/Program Files/Git:/usr/bin/core_perl)
I’ve just noticed something similar to this running opam-with-an-internal-Cygwin installation running in a different Cygwin installation - looks like you’re running opam-with-an-internal-Cygwin-installation in Git for Windows Bash (or an MSYS2 installation) and seeing a bigger version of the same problem.
(I also have an idea for a fix…)
I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with
/cygdrive/c/...or/cygdrive/d/...both should be equivalent in a cygwin context so i'm not sure why that would break things. Are you using MSYS2, an existing Cygwin installation or the recommended internal Cygwin installation?
I am using my git for windows bash.
...:/cygdrive/d/Program Files/Git/usr/bin/core_perlwhile my working PATH has it as...:/usr/bin/core_perlThis part is pretty surprising though, are you sure this is verbatim what's in your PATH? If so, opam is introducing the Git for Windows path without a separator (it should at least be
...:/cygdrive/d/Program Files/Git:/usr/bin/core_perl)
Yep