ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
516 stars 1.13k forks source link

prebuild 2.2-alpha3 opam binary failed to install ocaml under MSVC 2022 #24794

Open aryx opened 10 months ago

aryx commented 10 months ago

under Cmd:

C:\Users\pad\Downloads>opam.exe
usage: opam [--version]
            [--help]
            <command> [<args>]

The most commonly used opam commands are:
    init         Initialize opam state, or set init options.
    list         Display the list of available packages.
    show         Display information about specific packages.
    install      Install a list of packages.
    remove       Remove a list of packages.
    update       Update the list of available packages.
    upgrade      Upgrade the installed package to latest version.
    config       Display configuration options for packages.
    repository   Manage opam repositories.
    switch       Manage multiple installation prefixes.
    pin          Pin a given package to a specific version or source.
    admin        Tools for repository administrators

See 'opam help <command>' for more information on a specific command.

C:\Users\pad\Downloads>opam.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:

    for /f "tokens=*" %i in ('opam env') do @%i

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

opam doesn't have any configuration options for cmd; you will have to run for /f "tokens=*" %i in ('opam env') do @%i
whenever you change you current 'opam switch' or start a new terminal session. Alternatively, would you like to select
a different shell? [y/n] 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 "make SHELL=/bin/dash -j7 world.opt".

#=== 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\.cygwin\root\bin\make.exe SHELL=/bin/dash -j7 world.opt
# exit-code   2
# env-file    ~\AppData\Local\Temp\opam-pad-1992\ocaml-variants-1992-589545.env
# output-file ~\AppData\Local\Temp\opam-pad-1992\ocaml-variants-1992-589545.out
### output ###
# [...]
# cl -c -nologo -O2 -Gy- -MD  -d2VolatileMetadata-  -D_CRT_SECURE_NO_DEPRECATE -I ../flexdll -DCAML_NAME_SPACE -DUNICODE -D_UNICODE -DWINDOWS_UNICODE=1 -DCAMLDLLIMPORT=  -Focodefrag.b.obj codefrag.c
# cl -c -nologo -O2 -Gy- -MD  -d2VolatileMetadata-  -D_CRT_SECURE_NO_DEPRECATE -I ../flexdll -DCAML_NAME_SPACE -DUNICODE -D_UNICODE -DWINDOWS_UNICODE=1 -DCAMLDLLIMPORT=  \
#   -Foprims.obj prims.c
# codefrag.c
# prims.c
# link -lib -nologo -machine:AMD64  /out:libcamlrun_non_shared.lib  interp.b.obj misc.b.obj stacks.b.obj fix_code.b.obj startup_aux.b.obj startup_byt.b.obj freelist.b.obj major_gc.b.obj minor_gc.b.obj memory.b.obj alloc.b.obj roots_byt.b.obj globroots.b.obj fail_byt.b.obj signals.b.obj signals_byt.b.obj printexc.b.obj backtrace_byt.b.obj backtrace.b.obj compare.b.obj ints.b.obj eventlog.b.obj f[...]
# interp.b.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
# make[2]: *** [Makefile:277: libcamlrun_non_shared.lib] Error 88
# make[2]: Leaving directory '/cygdrive/c/Users/pad/AppData/Local/opam/default/.opam-switch/build/ocaml-variants.4.14.1+msvc64c/runtime'
# make[1]: *** [Makefile:145: boot/ocamlruns.exe] Error 2
# make[1]: Leaving directory '/cygdrive/c/Users/pad/AppData/Local/opam/default/.opam-switch/build/ocaml-variants.4.14.1+msvc64c'
# make: *** [Makefile:311: world.opt] Error 2

<><> 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 for /f "tokens=*" %i in ('opam env --switch=default') do @%i to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n]
kit-ty-kate commented 10 months ago

This once again seems to be an issue with either your setup or the packages so I moved it to opam-repository as a central point instead.