2

I am trying to install Coq version 8.10.2 using Opam and from this output, I assume Coq 8.10.2 needs an ocaml compiler with version < 4.10

Missing dependency:
    - (invariant) -> coq = 8.10.2 -> ocaml < 4.10 -> ocaml-base-compiler < 3.07+1 | ocaml-system < 3.07+1 | ocaml-variants < 3.8~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions: 'sys-ocaml-version = "3.07"'
    no matching version
.
.
.
  * Missing dependency:
    - (invariant) -> coq = 8.10.2 -> ocaml < 4.10 -> ocaml-base-compiler = 4.09.2 | ocaml-system >= 4.09.2 | ocaml-variants < 4.09.3~
    no matching version
    unmet availability conditions, e.g. 'sys-ocaml-version = "4.14.0"'
    unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'

and the problem is that ocaml with version < 4.10 is not available in opam's list of packages. Running opam switch list-available base prints this output

# Listing available compilers from repositories: default
# Name              # Version     # Synopsis
ocaml-base-compiler 4.10.2        Official release 4.10.2
ocaml-base-compiler 4.12.0~alpha1 First alpha release of OCaml 4.12.0
ocaml-base-compiler 4.12.0~alpha2 Second alpha release of OCaml 4.12.0
ocaml-base-compiler 4.12.0~alpha3 Third alpha release of OCaml 4.12.0
ocaml-base-compiler 4.12.0~beta1  First beta release of OCaml 4.12.0
ocaml-base-compiler 4.12.0~beta2  Second beta release of OCaml 4.12.0
ocaml-base-compiler 4.12.0~rc1    First release candidate of OCaml 4.12.0
ocaml-base-compiler 4.12.0        Official release 4.12.0
ocaml-base-compiler 4.12.1        Official release 4.12.1
ocaml-base-compiler 4.13.0~alpha1 First alpha release of OCaml 4.13.0
ocaml-base-compiler 4.13.0~alpha2 Second alpha release of OCaml 4.13.0
ocaml-base-compiler 4.13.0~beta1  First beta release of OCaml 4.13.0
ocaml-base-compiler 4.13.0~rc1    First release candidate of OCaml 4.13.0
ocaml-base-compiler 4.13.0~rc2    Second release candidate of OCaml 4.13.0
ocaml-base-compiler 4.13.0        Official release 4.13.0
ocaml-base-compiler 4.13.1        Official release 4.13.1
ocaml-base-compiler 4.14.0~alpha1 First alpha release of OCaml 4.14.0
ocaml-base-compiler 4.14.0~alpha2 Second alpha release of OCaml 4.14.0
ocaml-base-compiler 4.14.0~beta1  First beta release of OCaml 4.14.0
ocaml-base-compiler 4.14.0~rc1    First release candidate of OCaml 4.14.0
ocaml-base-compiler 4.14.0~rc2    Second release candidate of OCaml 4.14.0
ocaml-base-compiler 4.14.0        Official release 4.14.0

I want to use Opam because I need to switch to different version of Coq for other project. Is there a way I can add an ocaml version < 4.10 to opam?

  • Little bit of an XY problem aroma to this. Why is the old version of Coq needed? Perhaps there is a workaround there. – Chris Apr 27 '22 at 14:56

1 Answers1

4

How to install a specific version of OCaml?

To install a different version of OCaml, you need to create a new switch, e.g.,

opam switch create 3.12.0

Will install the corresponding version of OCaml. To get the list of available versions of OCaml, use,

opam switch list-available

Why is version N not available on my system?

From the error message, I can see that your system is an ARM64 macOS, and the specifications of the older versions of the OCaml package explicitly specify that they are not available on that system,

available: !(os = "macos" & arch = "arm64")

So the oldest version that is available for your architecture is 4.10.1. I can only suggest using a virtual machine, docker, or another physical machine.

ivg
  • 34,431
  • 2
  • 35
  • 63
  • The problem seems to be that old versions of OCaml don't show up on OP's system. – Li-yao Xia Apr 27 '22 at 14:26
  • As @Li-yaoXia mentioned, ocaml 3.12.0 does not show up in the output of "opam switch list-available", so running "spam switch create 3.12.0" returns a similar missing dependency error – Shubham Sondhi Apr 27 '22 at 14:38
  • Yes, @Li-yaoXia is right and I have updated the answer. – ivg Apr 27 '22 at 14:39