On 12.04, I have the latest version of Ocaml (4.01) installed with all the dependencies. I'm trying to install Coq, which depends on an older version (3.12) of the ocaml-base-nox runtime (via a virtual dependency). Running apt-cache policy ocaml-base-nox
gives the following output:
ocaml-base-nox:
Installed: 4.01.0-1ppa4~precise
Candidate: 4.01.0-1ppa4~precise
Version table:
*** 4.01.0-1ppa4~precise 0
500 http://ppa.launchpad.net/avsm/ppa/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
3.12.1-2ubuntu2 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
Ok, shouldn't be a problem, right? I just need to switch my version to 3.12 to install/use coq, then I can switch back to 4.01 when I need the newer version. It's not clear to me how to do this. After a little googling I tried the following:
$ sudo apt-get install ocaml-base-nox=3.12.1-2ubuntu2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
camlp4 camlp4-extra ocaml ocaml-base ocaml-compiler-libs ocaml-interp ocaml-native-compilers
ocaml-nox
The following packages will be DOWNGRADED:
ocaml-base-nox
0 upgraded, 0 newly installed, 1 downgraded, 8 to remove and 0 not upgraded.
Need to get 596 kB of archives.
After this operation, 205 MB disk space will be freed.
Do you want to continue [Y/n]?
It seems like it's going to remove my entire Ocaml stack, which I'll probably have to reinstall from scratch to use again. Furthermore, most of what I use Ocaml for (the mirage unikernal project) requires 4.0 or higher.
So, what, if any, is the correct way to switch between package versions? Is there a way I can force apt-get to install something without uninstalling anything?