Skip to content
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

After having installed opam with msys, the command opam init fails #5713

Open
Chimrod opened this issue Oct 31, 2023 · 8 comments
Open

After having installed opam with msys, the command opam init fails #5713

Chimrod opened this issue Oct 31, 2023 · 8 comments

Comments

@Chimrod
Copy link

Chimrod commented Oct 31, 2023

I’ve upgraded opam to the latest version git version. The compilation process now works fine, but I have an error when creating a new fresh environnent.

2023-10-31_11h10_24

$ opam config report
# opam config report
# opam-version         2.2.0~alpha3~dev (c4961baf23e681c74b381a5f9c2cfd7362740e68)
# self-upgrade         no
# system               arch=x86_64 os=win32 os-distribution=cygwin os-version=10.0.22621
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 7
# current-switch       none set

I’ve extracted the log and the environment files generated by opam:

ocaml-base-compiler-25444-20665a.env.txt
ocaml-base-compiler-25444-20665a.out.txt

@kit-ty-kate
Copy link
Member

Note that opam does not officially support running with a MSYS2 environment at the moment, we only officially support Cygwin. We currently do not have the knowledge or time necessary to support and test both. Hopefully in the future but not now. That said, with sufficiant knowledge of MSYS2 it should work in theory, if i remember correctly.

A quick look at a search engine with the error you got, gives me msys2/MSYS2-packages#1794, which looks like it states that mixing mingw libraries and msys2 system libraries can lead to this kind of error.
Your PATH contains both the mingw path and the msys2 system (as well as a cygwin path?). Maybe it would work if you removed D:\msys64\mingw64\bin; from your PATH.

cc @jonahbeckford in case you’re interested.

@jonahbeckford
Copy link
Contributor

Yes, the latest versions of opam install Cygwin during its opam initialization; that uses a DLL cygwin1.dll that cannot be active at the same time as MSYS2 (msys-2.0.dll). Even though there was no official support for MSYS2, MSYS2 did work quite well. You may be better off using an older version of opam (ie. commits around 2022/12/21).

And if you are just looking for prebuilt native Windows binaries (compatible with MSYS2), grab v2.2.0-alpha-20221228 from https://github.com/diskuv/dkml-component-opam/releases.

@kit-ty-kate
Copy link
Member

Even though there was no official support for MSYS2, MSYS2 did work quite well. You may be better off using an older version of opam (ie. commits around 2022/12/21).

Do you know what broke it? Is it the thing you explained in #5683 or is there something else?

@Chimrod
Copy link
Author

Chimrod commented Nov 1, 2023

Hello, thanks all for your answer. I completely understand that the situation here is very specific, but I didn’t know if it was out of the scope or not. As I know you are still stabilizing the windows version, I’ve estimated this issue could be reported here.

@jonahbeckford
Copy link
Contributor

Yes, it is the thing in #5683 (which is being worked on).

@kit-ty-kate
Copy link
Member

@Chimrod how did you use opam init ? Could you try #5683 (comment)

@Chimrod
Copy link
Author

Chimrod commented Nov 15, 2023

(Oh, I’ve answer in the wrong ticket. Sorry for the noise.)

When I specify the path to msys (in my case D:\msys64), opam look for a subdirectory \home\msys64 which do not exists:

$ opam init  --cygwin-location=D:\msys64
[WARNING] Flag --cygwin-location is experimental, there is no guarantee that it will be kept; avoid using it in
          scripts.
No configuration file found, using built-in defaults.

<><> Unix support infrastructure ><><><><><><><><><><><><><><><><><><><><><>  🐫
[ERROR] Error while checking Cygwin install (C:\cygwin64): D:\msys64\home\msys64 not found!

I’ve tried differents way to spectify the path, but I do not understand the hierarchy required

@rjbou
Copy link
Collaborator

rjbou commented Nov 29, 2023

Which term are you using ? i'm testing it with cmd (make cold on cygwin), and there is no path rewriting. It is not working because it detects that it is not an cygwin install, but looks for in the given path.
The good path to give is the one that contains bin directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants