Adding an old version of Ocaml to Opam

402 Views Asked by At

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?

1

There are 1 best solutions below

3
On

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.