Creating opam switch version 5.1.1

This issue could be related to this one. I installed Ocaml on windows, and now I would like to create a new switch. In powershell I typed the following:

opam switch create ocaml-base-compiler 5.1.1 --jobs=1

Here is the output that I get:

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "5.1.1"} | "ocaml-system" {= "5.1.1"}]
[NOTE] It seems you have not updated your repositories for a while. Consider updating them with:
       opam update

[NOTE] External dependency handling not supported for OS family 'windows'.
       You can disable this check using 'opam option --global depext=false'

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
✢ installed base-bigarray.base
✢ installed base-threads.base
✢ installed base-unix.base
✢ installed ocaml-options-vanilla.1
β–Ό retrieved ocaml-base-compiler.5.1.1  (cached)
[ERROR] The compilation of ocaml-base-compiler.5.1.1 failed at "./configure --prefix=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-base-compiler
        --docdir=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-base-compiler\\doc/ocaml -C".

#=== ERROR while compiling ocaml-base-compiler.5.1.1 ==========================#
# context     2.2.0~alpha0~20221228-r3 | win32/x86_64 |  | git+https://github.com/ocaml/opam-repository.git#6c3f73f42890cc19f81eb1dec8023c2cd7b8b5cd
# path        C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler\.opam-switch\build\ocaml-base-compiler.5.1.1
# command     C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler\.opam-switch\build\ocaml-base-compiler.5.1.1\./configure --prefix=C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler --docdir=C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler\doc/ocaml -C
# exit-code   1
# env-file    C:\Users\shuri\AppData\Local\opam\log\ocaml-base-compiler-32616-3d9021.env
# output-file C:\Users\shuri\AppData\Local\opam\log\ocaml-base-compiler-32616-3d9021.out
### output ###
# [...]
# checking whether stripping libraries is possible... no
# checking if libtool supports shared libraries... yes
# checking whether to build shared libraries... yes
# checking whether to build static libraries... yes
# checking how to run the C preprocessor... cl.exe -E
# checking C compiler vendor... msvc-1929
# checking whether host executables can be run in the build... yes
# checking whether #! works in shell scripts... yes
# checking whether the C compiler supports -d2VolatileMetadata-... yes
# checking for flexdll sources... checking for flexlink... flexlink
# checking whether flexlink works... no
# configure: error: flexlink does not work



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
β”Œβ”€ The following actions failed
β”‚ Ξ» build ocaml-base-compiler 5.1.1
└─
β”Œβ”€ The following changes have been performed (the rest was aborted)
β”‚ ✢ install base-bigarray         base
β”‚ ✢ install base-threads          base
β”‚ ✢ install base-unix             base
β”‚ ✢ install ocaml-options-vanilla 1
└─
# Run eval $(opam env --switch=ocaml-base-compiler) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n]

What is a flexlink? Why doesn’t it work?

See GitHub - ocaml/flexdll: a dlopen-like API for Windows Flexdll is used when an OCaml program needs a DLL function. It may also be used with programs with statically linked libraries (in the sense embedded in the EXE file), but used dynamical with Ctypes.

It must be a bug, but if you want to raise an issue, be more precise (which Windows version - opam, Diskuv - which C compiler - mingw, mscv….)

1 Like

I would like to report this issue. Here is some information you requested:

Windows version: 11 Family, x64
opam version: 2.2.0~alpha0~20221228-r3
dkml version: 2.1.1
gcc --version : 13.2.0

I hope it helps

After updating opam to version 2.2.0, and rerunning the switch creation command I get:

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><>  🐫
Switch invariant: ["ocaml-base-compiler" {= "5.1.1"} | "ocaml-system" {= "5.1.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
βˆ— installed base-bigarray.base
βˆ— installed base-threads.base
βˆ— installed base-unix.base
βˆ— installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.5.1.1  (cached)
[ERROR] The compilation of ocaml-base-compiler.5.1.1 failed at "./configure
        --prefix=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-base-compiler
        --docdir=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-base-compiler\\doc/ocaml -C".

#=== ERROR while compiling ocaml-base-compiler.5.1.1 ==========================#
# context     2.2.0 | win32/x86_64 |  | git+https://github.com/ocaml/opam-repository.git#6c3f73f42890cc19f81eb1dec8023c2cd7b8b5cd
# path        ~\AppData\Local\opam\ocaml-base-compiler\.opam-switch\build\ocaml-base-compiler.5.1.1
# command     ~\AppData\Local\opam\ocaml-base-compiler\.opam-switch\build\ocaml-base-compiler.5.1.1\./configure --prefix=C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler --docdir=C:\Users\shuri\AppData\Local\opam\ocaml-base-compiler\doc/ocaml -C
# exit-code   77
# env-file    ~\AppData\Local\opam\log\ocaml-base-compiler-2044-87c44d.env
# output-file ~\AppData\Local\opam\log\ocaml-base-compiler-2044-87c44d.out
### output ###
# [...]
# checking host system type... x86_64-pc-cygwin
# checking target system type... x86_64-pc-cygwin
# checking for ld... no
# checking for link... link
# checking how to print strings... printf
# checking for gcc... no
# checking for cc... no
# checking for cl.exe... cl.exe
# checking whether the C compiler works... no
# configure: error: in `/cygdrive/c/Users/shuri/AppData/Local/opam/ocaml-base-compiler/.opam-switch/build/ocaml-base-compiler.5.1.1':
# configure: error: C compiler cannot create executables
# See `config.log' for more details



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build ocaml-base-compiler 5.1.1
└─
β”Œβ”€ The following changes have been performed (the rest was aborted)
β”‚ βˆ— install base-bigarray         base
β”‚ βˆ— install base-threads          base
β”‚ βˆ— install base-unix             base
β”‚ βˆ— install ocaml-options-vanilla 1
└─
# Run (& opam env --switch=ocaml-base-compiler) -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]

I have a similar question regarding an other version of switch. Now the error message is exactly the same in both cases. Should one of these questions be closed?

The solution is here.