OPAM package not working

I installed OPAM and ran the initialization and updated my .bashrc code. Then I installed the ocamlfind package, which was successful. But when I try

#use "topfind";; 

I get the following

 Cannot find file topfind 

I am running ocaml 4.00.1, built from source on Opensuse 12.2.

+6
source share
3 answers

If $OCAML_TOPLEVEL_PATH not defined, you must define it:

 export OCAML_TOPLEVEL_PATH=/home/%user%/.opam/%version%/lib/toplevel 

Remember to change %user% and your compiler %version%

Check issue in opam bugtracker.

+4
source

First you need to export the correct environment variables by doing the following:

 eval `opam config env` 

To be more efficient, you should put this line in your ~/.profile (or ~/.bashrc ).

Then, if you use the system compiler, you can add these lines to your ~/.ocamlinit :

 let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () 

We are working to improve this process until release 1.0.

+8
source

What if you start filling out how

rlwrap ocaml -I "$OCAML_TOPLEVEL_PATH"

You can also try an alternative: utop (it exists in OPAM)

+1
source

All Articles