Is this an opam anomaly?

In attempting to install to an empty local switch I see a failure with ocaml-config, which appears to be looked for in the wrong place.
I don’t know whether this is an unsupported thing or an opam bug…

opam switch create --empty .
OPAMSWITCH=./. opam install ocaml.4.14.2
The following actions will be performed:
∗ install base-bigarray base
∗ install base-threads base
∗ install base-unix base
∗ install ocaml-variants 4.14.2+trunk [required by ocaml]
∗ install ocaml-config 2 [required by ocaml]
∗ install ocaml 4.14.2
===== ∗ 6 =====
Do you want to continue? [Y/n]
y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
:arrow_down: retrieved ocaml-variants.4.14.2+trunk (https://github.com/ocaml/ocaml/archive/4.14.tar.gz)
∗ installed ocaml-variants.4.14.2+trunk

#=== ERROR while compiling ocaml-config.2 =====================================#
Sys_error(“/home/dev/.opam/repo/default/packages/ocaml-config/ocaml-config.2/files/gen_ocaml_config.ml.in: No such file or directory”)

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-config 2
└─

4.14.2 has never been released. It looks like opam is trying to use some build instructions that aren’t in sync with the code to build. Please try to install 4.14.1 instead

1 Like

it’s in the opam repository.
a different error though with 4.14.1:
#=== ERROR while compiling ocaml-base-compiler.4.14.1 =========================#
Sys_error(“/home/dev/.opam/repo/default/packages/ocaml-base-compiler/ocaml-base-compiler.4.14.1/files/ocaml-base-compiler.install: No such file or directory”)

There’s definitively something that trips up opam and should be reported more gracefully but this OPAMSWITCH set to ./. is very dubious. This should be set to a switch name (see opam switch list). It might be this.

I found the wiki below and readied myself for a deep dive of debugging.
the very first thing it said was to run ‘opam update’ which I did.
…and the problem went away!
since originally posting I found another usage of this empty/install formula I knew to be working, now failing.
hence my setup transitioned to malfunctional at some point without, I’m sure, my having disturbed anything relating to opam.
which is curious and if any opam maintainer out there would care to comment on how that might happen and ‘opam update’ rectifies matters, I would be glad to read it.

https://www.ocamlwiki.com/index.php?title=Debugging_OPAM&section=1

ocamlwiki seems to be a LLM-filled website. I would encourage you to avoid it, see this discussion: What's up with ocamlwiki?

as for this, this is pretty simple. The file mentioned above was somehow removed (how is the mystery) and opam update simply redownloads the repository and sync it with what you have locally so in this case it saw that the file was missing and copied it back.

Could you submit a bug report in the opam bugtracker with the result of opam config report and the output of the failing command?

Given another user reported a similar issue a few days ago on here I’m wondering if there are something in common between you two. cc @dromas