diskuv / dkml-installer-ocaml

The Windows-friendly distribution of OCaml
Apache License 2.0
62 stars 2 forks source link

`opam switch create .` fails #32

Closed apsheronets closed 1 year ago

apsheronets commented 1 year ago

I'm not sure is that related to dklm itself or just underlying software, but it works like this:

> opam -r _opam
> opam switch create .
[ERROR] Directory "C:\\Users\\User\\project\\_opam" already exists, please choose a different name
> find _opam
_opam
_opam/.dkml
_opam/.dkml/compiler-cache
_opam/.dkml/compiler-cache/3ba4ec083c93c654cc2705fbbcde40d8ef4bd783e412ecddbe596fcfb1d65ef4.sexp
jonahbeckford commented 1 year ago

Because Windows unfortunately needs custom opam repositories, custom opam options and several opam pins to work, opam switch create is not the best way to create switches on Windows. You can use dkml init (no arguments) instead from an empty directory (or any directory without an existing _opam) to create an opam local switch.

PS. dkml init also handles upgrading a switch when you install a new DKML version. Especially important when DKML installs a new system OCaml compiler.

jonahbeckford commented 1 year ago

That should already be documented on the Beyond Basics documentation page.

apsheronets commented 1 year ago

Yeah, I just realized opam switch create . is useless with dkml when I was trying to link a trivial executable and got errors about dvapi32.lib and ws2_32.lib.