Open e00E opened 6 months ago
We should check this before Coq Platform starts setup in the upfront sanity checks - that is before even installing opam.
Can you suggest a piece of shell script to detect this situation say using pacman
? I would test if pacman
itself exists to see if this is applicable and add similar tests for a few other platforms.
If your goal is to check whether ocaml-findlib is installed, then you can do pacman -Q ocaml-findlibs
. If ocaml-findlibs is installed, the command will return status code 0. If it is not installed, it will return status code 1.
However, a more correct check might need to rely directly on ocaml and opam since those are the tools that are confused by ocaml-findlibs already existing. The installation of Coq should succeed, even if ocaml-findlibs is installed. It is a bug that they don't.
We should check this before Coq Platform starts setup in the upfront sanity checks - that is before even installing opam.
Note that in my case, I install opam through the Arch Linux package manager. In this case a like what you propose doesn't make sense. But it might make sense for Coq Platform.
Note that in my case, I install opam through the Arch Linux package manager.
Coq Platform does install opam if it is not installed yet - if it finds a usable (not too old) opam, it will use it (but always create a new switch). But Coq Platform does the sanity checks before it starts installing anything. It is quite annoying if scripts run half through and then find that there is an issue and you have to restart from scratch.
In the end this needs to be fixed in opam, probably by supplying a patched findlib which ignores system installed OCaml and Coq packages. There is already a patched findlib in opam, but its purpose is to supply switch local libraries. But doing upfront sanity checks has proven to be very effective.
Following the official instructions on installing Coq through opam does not work on Arch Linux if the ocaml-findlib Arch Linux package is installed. For me, the package was installed because I previously installed the Arch Linux coq package. I decided to install Coq through opam and removed the Arch Linux Coq package, but I did not uninstall ocaml-findlib.
You can easily reproduce this issue with a clean Arch installation through Docker.
The last command errors with the following message.
Note that if you don't install ocaml-findlib, the installation succeeds.
At this point you can run more investigative commands like
ocamlfind list
:This issue has been discussed on Zulip.