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-variants 5.3.0+trunk --jobs=1
Here is the output that I get:
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-variants" {= "5.3.0+trunk"}]
[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
βΌ retrieved ocaml-variants.5.3.0+trunk (https://github.com/ocaml/ocaml/archive/trunk.tar.gz)
[ERROR] The compilation of ocaml-variants.5.3.0+trunk failed at "./configure --prefix=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-variants
--docdir=C:\\Users\\shuri\\AppData\\Local\\opam\\ocaml-variants\\doc/ocaml -C --disable-warn-error".
#=== ERROR while compiling ocaml-variants.5.3.0+trunk =========================#
# 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-variants\.opam-switch\build\ocaml-variants.5.3.0+trunk
# command C:\Users\shuri\AppData\Local\opam\ocaml-variants\.opam-switch\build\ocaml-variants.5.3.0+trunk\./configure --prefix=C:\Users\shuri\AppData\Local\opam\ocaml-variants --docdir=C:\Users\shuri\AppData\Local\opam\ocaml-variants\doc/ocaml -C --disable-warn-error
# exit-code 69
# env-file C:\Users\shuri\AppData\Local\opam\log\ocaml-variants-16204-0d7240.env
# output-file C:\Users\shuri\AppData\Local\opam\log\ocaml-variants-16204-0d7240.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 accepts -Wold-style-declaration... no
# checking whether the C compiler accepts -Wimplicit-fallthrough=5... no
# checking whether the C compiler accepts -Wimplicit-fallthrough... no
# configure: error: This version of MSVC is too old. Please use Visual Studio version 17.8 or above.
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
ββ The following actions failed
β Ξ» build ocaml-variants 5.3.0+trunk
ββ
ββ The following changes have been performed (the rest was aborted)
β βΆ install base-bigarray base
β βΆ install base-threads base
β βΆ install base-unix base
ββ
# Run eval $(opam env --switch=ocaml-variants) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n]
This is very confusing because I have the latest Visual Studio version. Do you have any idea how to fix it?