Calls to curl by opam fail on Windows installation

Note: I removed all the http:// prefixes since the discourse doesn’t allow more than 2 links for new users

Execution of the following…

$ opam install dune utop ocaml-lsp-server

leads to:
The following actions will be performed:
∗ install dune 3.5.0
∗ install seq base [required by re]
∗ install ocamlbuild 0.14.2 [required by uutf]
∗ install ocamlfind 1.9.5 [required by utop]
etc…
ending with:
===== ∗ 43 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[cppo.1.6.9] found in cache
[csexp.1.5.1] found in cache

[WARNING] ocamlfind.1.9.5: download of
{omitted the links since discourse blocks the message otherwise}
[dune-build-info.3.5.0] downloaded from github.com/ocaml/dune/releases/download/3.5.0/dune-3.5.0.tbz
[omd.1.3.2] found in cache
[ordering.3.5.0] found in cache
[stdune.3.5.0] found in cache
[topkg.1.0.6] found in cache
[xdg.3.5.0] found in cache
[ERROR] The sources of the following couldn’t be obtained, aborting:
- chrome-trace.3.5.0: Curl failed
- dune.3.5.0: Curl failed
- dune-configurator.3.5.0: Curl failed
- dune-rpc.3.5.0: Curl failed
- dyn.3.5.0: Curl failed
- fiber.3.5.0: Curl failed
- lambda-term.3.3.1: Curl failed
- logs.0.7.0: Curl failed
- lwt.5.6.1: Curl failed
- lwt_react.1.2.0: Curl failed
etc (another 10 or so failures)

What are we doing wrong?

It’s likely a problem of connectivity with your computer. Since you mention http:// working could it be a certificate issue ? Maybe try to:

curl -O -L https://github.com/ocaml/dune/releases/download/3.13.1/dune-3.13.1.tbz

to see if that works.

I think there is a bigger problem with opam and curl on Windows today. I can’t remember what the root cause is, but I’m going to guess it had to do with command line escaping. See Broken use of curl in 2.2.0~alpha3 on native Windows · Issue #5681 · ocaml/opam · GitHub

What I have done as a work-around for DkML users is to do opam option --yes --global download-command=wget. That switches everything from curl to wget. (dkml-workflows/src/scripts/setup-dkml.sh at 33c9b5a6c04a32f64f3a4ecb7aff6727cfbb34a2 · diskuv/dkml-workflows · GitHub)

Could you submit a bug report in the opam bugtracker with the result of opam config report and opam install --debug dune ?