ocamlfind cannot see installed package

Stephen Dedalus picture Stephen Dedalus · Jan 3, 2014 · Viewed 10.3k times · Source

I wanted to compile my project using command:

ocamlfind ocamlopt -package ocamlnet -package batteries -package unix -linkpkg oauth.ml

but I'm getting following error:

ocamlfind: Package `ocamlnet' not found
make: *** [oauth.cmi] Error 2

After some research on this problem I have read that there may be problem with packages installed via opam and packages installed before opam installation (in this case with ocamlfind) so I tried to check that and get stuck because ocamlfind is installed via opam. Does anybody know what may I try to do to solve that problem?

$ which ocamlfind
/home/user/.opam/4.00.1/bin/ocamlfind

$ opam list 
Installed packages for 4.00.1:
[...]
ocamlfind             1.4.0  A library manager for OCaml
[...]

Thanks in advance.

Answer

TheNiceGuy picture TheNiceGuy · Jan 3, 2014

Do a:

eval $(opam config env)

That should fix the problem.

# Edit 1:

If it still does not work remove the dir

/home/user/.opam/4.00.1

and try it again.