I am trying to do a very basic installation of OPAM under MacOS. Using macports I've installed following packages:
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.
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
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.