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

ocaml-variants packages for windows do not work #24791

Open
aryx opened this issue Nov 14, 2023 · 4 comments
Open

ocaml-variants packages for windows do not work #24791

aryx opened this issue Nov 14, 2023 · 4 comments
Assignees

Comments

@aryx
Copy link
Contributor

aryx commented Nov 14, 2023

PS C:\Users\pad> dir


    Directory: C:\Users\pad


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          3/8/2018   1:37 PM                .dotnet
d-----          3/8/2018   1:57 PM                .vscode
d-r---          6/1/2022  10:23 AM                3D Objects
d-----          5/9/2018   8:06 PM                ansel
d-r---          6/1/2022  10:23 AM                Contacts
d-r---        11/14/2023   8:36 AM                Desktop
d-r---          6/1/2022  10:23 AM                Documents
d-r---        11/14/2023   7:38 PM                Downloads
d-r---          6/1/2022  10:23 AM                Favorites
d-r---          6/1/2022  10:23 AM                Links
d-r---          6/1/2022  10:23 AM                Music
dar---         5/23/2021   9:02 AM                OneDrive
d-r---          6/1/2022  10:23 AM                Pictures
d-r---          6/1/2022  10:23 AM                Saved Games
d-r---          6/1/2022  10:23 AM                Searches
d-----          3/9/2018   2:56 AM                source
d-r---        11/14/2023  12:37 PM                Videos
-a----          5/8/2018   1:21 AM              0 Sti_Trace.log


PS C:\Users\pad>
PS C:\Users\pad>
PS C:\Users\pad> .\Downloads\opam-2.2.0-alpha3-preview-for-windows.exe init git+https://github.com/ocaml-opam/opam-repository-mingw
No configuration file found, using built-in defaults.

<><> Unix support infrastructure ><><><><><><><><><><><><><><><><><><><><><><><>

opam and the OCaml ecosystem in general require various Unix tools in order to operate correctly. At present, this requires the installation of Cygwin to provide these tools.

How should opam handle Cygwin?
> 1. Automatically create an internal Cygwin installation that will be managed by opam
  2. Enter the location of an existing Cygwin installation
  3. Abort initialisation

[1/2/3] 1
[NOTE] Configured with internal Cygwin install for depexts
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.


<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[default] Initialised

<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><><><>

  In normal operation, opam only alters files within ~\AppData\Local\opam.

  However, to best integrate with your system, some environment variables
  should be set. When you want to access your opam installation, you will
  need to run:

    (& opam env) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ }

  You can always re-run this setup with 'opam init' later.

opam doesn't have any configuration options for powershell; you will have to run (& opam env) -split '\r?\n' |
ForEach-Object { Invoke-Expression $_ } whenever you change you current 'opam switch' or start a new terminal session.
Alternatively, would you like to select a different shell? [y/n]

<><> Creating initial switch 'default' (invariant ["ocaml" {>= "4.05.0"}]) ><><>

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml" {>= "4.05.0"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
✶ installed base-bigarray.base
✶ installed base-threads.base
✶ installed base-unix.base
▼ retrieved ocaml-variants.4.14.1+msvc64c  (https://github.com/ocaml/ocaml/archive/refs/tags/4.14.1.tar.gz)
[ERROR] The compilation of ocaml-variants.4.14.1+msvc64c failed at "./configure
        --prefix=C:\\Users\\pad\\AppData\\Local\\opam\\default --with-flexdll --host=x86_64-pc-windows".

#=== ERROR while compiling ocaml-variants.4.14.1+msvc64c ======================#
# context     2.2.0~alpha3 | win32/x86_64 |  | git+https://github.com/ocaml-opam/opam-repository-mingw
# path        ~\AppData\Local\opam\default\.opam-switch\build\ocaml-variants.4.14.1+msvc64c
# command     ~\AppData\Local\opam\default\.opam-switch\build\ocaml-variants.4.14.1+msvc64c\./configure --prefix=C:\Users\pad\AppData\Local\opam\default --with-flexdll --host=x86_64-pc-windows
# exit-code   77
# env-file    ~\AppData\Local\Temp\opam-pad-7520\ocaml-variants-7520-c28f2a.env
# output-file ~\AppData\Local\Temp\opam-pad-7520\ocaml-variants-7520-c28f2a.out
### output ###
# [...]
# checking host system type... x86_64-pc-windows
# checking target system type... x86_64-pc-windows
# checking for x86_64-pc-windows-ld... no
# checking for x86_64-pc-windows-link... no
# checking for ld... no
# checking for link... link
# checking how to print strings... printf
# checking for x86_64-pc-windows-gcc... cl
# checking whether the C compiler works... no
# configure: error: in `/cygdrive/c/Users/pad/AppData/Local/opam/default/.opam-switch/build/ocaml-variants.4.14.1+msvc64c':
# configure: error: C compiler cannot create executables
# See `config.log' for more details



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-variants 4.14.1+msvc64c
└─
┌─ The following changes have been performed (the rest was aborted)
│ ✶ install base-bigarray base
│ ✶ install base-threads  base
│ ✶ install base-unix     base
└─
# Run (& opam env --switch=default) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ } to update the current
shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n]
[NOTE] Opam has been initialised, but the initial switch creation failed.
       Use 'opam switch create <compiler>' to get started.
PS C:\Users\pad>
PS C:\Users\pad>
PS C:\Users\pad>

@aryx
Copy link
Contributor Author

aryx commented Nov 14, 2023

PS C:\Users\pad> .\Downloads\opam-2.2.0-alpha3-preview-for-windows.exe switch create 4.14.1+mingw64c

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-variants" {= "4.14.1+mingw64c"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
✶ installed base-bigarray.base
✶ installed base-threads.base
✶ installed base-unix.base
▼ retrieved ocaml-variants.4.14.1+mingw64c  (cached)
[ERROR] The compilation of ocaml-variants.4.14.1+mingw64c failed at "./configure
        --prefix=C:\\Users\\pad\\AppData\\Local\\opam\\4.14.1+mingw64c --with-flexdll --host=x86_64-w64-mingw32
        CC=x86_64-w64-mingw32-gcc CPP=x86_64-w64-mingw32-cpp".

#=== ERROR while compiling ocaml-variants.4.14.1+mingw64c =====================#
# context     2.2.0~alpha3 | win32/x86_64 |  | git+https://github.com/ocaml-opam/opam-repository-mingw
# path        ~\AppData\Local\opam\4.14.1+mingw64c\.opam-switch\build\ocaml-variants.4.14.1+mingw64c
# command     ~\AppData\Local\opam\4.14.1+mingw64c\.opam-switch\build\ocaml-variants.4.14.1+mingw64c\./configure --prefix=C:\Users\pad\AppData\Local\opam\4.14.1+mingw64c --with-flexdll --host=x86_64-w64-mingw32 CC=x86_64-w64-mingw32-gcc CPP=x86_64-w64-mingw32-cpp
# exit-code   77
# env-file    ~\AppData\Local\opam\log\ocaml-variants-5520-1e1907.env
# output-file ~\AppData\Local\opam\log\ocaml-variants-5520-1e1907.out
### output ###
# [...]
# checking host system type... x86_64-w64-mingw32
# checking target system type... x86_64-w64-mingw32
# checking for x86_64-w64-mingw32-ld... no
# checking for x86_64-w64-mingw32-link... no
# checking for ld... no
# checking for link... link
# checking how to print strings... printf
# checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
# checking whether the C compiler works... no
# configure: error: in `/cygdrive/c/Users/pad/AppData/Local/opam/4.14.1+mingw64c/.opam-switch/build/ocaml-variants.4.14.1+mingw64c':
# configure: error: C compiler cannot create executables
# See `config.log' for more details



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-variants 4.14.1+mingw64c
└─
┌─ The following changes have been performed (the rest was aborted)
│ ✶ install base-bigarray base
│ ✶ install base-threads  base
│ ✶ install base-unix     base
└─
# Run (& opam env --switch=4.14.1+mingw64c) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ } to update the
current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] y

@kit-ty-kate kit-ty-kate transferred this issue from ocaml/opam Nov 14, 2023
@kit-ty-kate
Copy link
Member

kit-ty-kate commented Nov 14, 2023

As far as I can tell this is an issue in the packages or your setup, not in opam itself. I’ve moved the issue to opam-repository which while doesn’t support Windows at the moment is a good enough central point for issues in opam-repository-mingw and @dra27’s fork of opam-repository, as the ultimate goal is to upstream everything in opam-repository.

@kit-ty-kate kit-ty-kate changed the title opam 2.2 alpha3 prebuilt binary fails at installation time ocaml-variants packages for windows do not work Nov 14, 2023
@aryx
Copy link
Contributor Author

aryx commented Nov 14, 2023

This is from a fresh install, and from the error it looks like even if opam managed to locally install cygwin, it is not able to call it appropriately to create executables.

@aryx
Copy link
Contributor Author

aryx commented Nov 14, 2023

Which opam switch you managed to create on your windows machine @kit-ty-kate ?
When I run the opam init ...mingw-repo command, it tried to create 4.05 and failed. I then tried 4.14.1+mingw and failed.
Yes I have opam working on windows, but I can't do anything with it.

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

No branches or pull requests

3 participants