2

I am trying to do a very basic installation of OPAM under MacOS. Using macports I've installed following packages:

  1. opam @1.2.0
  2. ocaml-findlib @1.5.5
  3. ocaml-camlp4 @4.02.0.1_1

when I did opam init (not as root, since I only need it for one user). opam switch shows me that I am using system compiler:

system C system System compiler (4.02.1)

Then I tried to install 'lwt' via opam it failed halfway with errors:

# ocamlfind: Package `camlp4' not found
# W: Failure("Command ''/Users/lord/.opam/system/bin/ocamlfind' query -format %d camlp4 > '/var/folders/hh/h6kt24208xj44z0059_xd9rh0000gn/T/oasis-ca8248.txt'' terminated with error code 2")

This is my opam list:

# Installed packages for system:
base-bigarray           base  Bigarray library distributed with the OCaml compil
base-threads            base  Threads library distributed with the OCaml compile
base-unix               base  Unix library distributed with the OCaml compiler
camlp4         4.02.1+system  Camlp4 is a system for writing extensible parsers
ocamlfind              1.5.5  A library manager for OCaml

I have noticed that it has it own ocamlfind, not system one. Perhaps this is what is causing error:

$ /Users/lord/.opam/system/bin/ocamlfind query -format %d camlp4
ocamlfind: Package `camlp4' not found

$ /opt/local/bin/ocamlfind query -format %d camlp4
/opt/local/lib/ocaml/camlp4

I tried before installing OCAML compiler and CAMLP via OPAM and it this case it works, but it bothers me that I have two compiler installations for the same version. I would rather use system OCAML compiler and CAMLP, if possible.

krokodil
  • 1,326
  • 10
  • 18

1 Answers1

3

I'm not sure what goes wrong on your installation, maybe you shouldn't install ocaml-findlib as they may conflict in some manner. I will look at this later. Currently, the following works

$ sudo port install ocaml ocaml-camlp4 opam
$ opam init
$ opam install ocamlfind

This will lead to a working installation:

$ ocamlfind query camlp4
/opt/local/lib/ocaml/camlp4
$ which ocamlfind
/Users/ivg/.opam/system/bin/ocamlfind

Update

I've checked my hypothesis that system's ocamlfind may conflict with the opam's one. It doesn't get any evidence. Even if you install both of them everything works fine:

$ sudo port install ocaml-findlib
$ opam init

System's ocamlfind works pretty well:

$ ocamlfind query camlp4
/opt/local/lib/ocaml/camlp4
$ which ocamlfind
/opt/local/bin/ocamlfind

Now let's try to install it from opam:

$ opam install ocamlfind

It also works pretty well:

$ ocamlfind query camlp4
/opt/local/lib/ocaml/camlp4
$ which ocamlfind
/Users/ivg/.opam/system/bin/ocamlfind

And

$ opam install lwt

worked pretty fine too.

So, maybe you moved somewhere in a wrong direction, and you can just remove your ~/.opam and start from scratch. And also, I hope that you didn't forget to activate your opam with magical:

$ eval `opam config env`

command.

ivg
  • 34,431
  • 2
  • 35
  • 63
  • yes, system ocaml-findlib seems to be the problem. After uninstalling it as you suggested it worked. However there are system-wide ocaml packages which depend on ocaml-findlib such as ocaml-ssl. – krokodil Mar 22 '15 at 18:49
  • I've removed my ~/.opam and re-initialized and now it seems to be working. Please note that OPAM installs it's own copy of ocamlfind instead of using one installed by port. So there is a bit of redundancy there, but I guess it is OK. – krokodil Mar 22 '15 at 20:11
  • I suspect the problem was in order of installation of the packages. – krokodil Mar 22 '15 at 20:20
  • Actually I get back to the original problem. After installing some more OPAM packages I am getting the following error: "The following would require downgrades or uninstalls, but you may upgrade them explicitely: - lwt.2.4.8" – krokodil Mar 24 '15 at 04:33
  • this doesn't look like an original problem for me. Since there is no aspcud solver packed with macports, the internal one is use, which is not very good. In case of downgrades, try to specify versions explicitely, like `opam install lwt.2.4.8 cohttp.0.15` all at once. This will help the solver – ivg Mar 24 '15 at 10:12