1

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?

2
  • I know how to do that; the problem is that I want both installed at the same time and apt-get wants to delete everything to do with the newer version in order to install the older version. Sep 19, 2014 at 8:10
  • serverfault.com/questions/279329/…
    – Panther
    Sep 19, 2014 at 12:41

1 Answer 1

0

Yes, in fact, you probably don't have to do any of that stuff at all. Most of the time, the dependency version specified in a case like yours is for >version meaning, the specified version or any version greater. If you want to install coq, just type the following commands and apt-get will automatically call the necessary dependencies for you. To do this, open a terminal and type the following commands:

sudo apt-get update
sudo apt-get install coq

If you still have the same issue it wouldn't be a problem for you to uninstall and then reinstall those packages. Unless you use the purge command, the configuration files for the removed software will remain intact; reinstallation will restore all user settings and no additional setup should be required.

You can use the following command to restore those packages:

sudo apt-get install camlp4 camlp4-extra ocaml ocaml-base ocaml-compiler-libs ocaml-interp ocaml-native-compilers ocaml-nox
1
  • I tried apt-get update and apt-get install first, but that gives errors saying "I have held broken packages." Then I tried installing with aptitude, which let me know that I needed the version 3.12 dependency in order to install everything. I think I'm just going to uninstall/reinstall; seems like the only way forward. Sep 19, 2014 at 8:12

Not the answer you're looking for? Browse other questions tagged .