1

I have just installed a library called Apron, the installation seems to be done:

@ubuntu$ find -name "*apron*"
./lib/libapron_debug.so
./lib/libapron.a
./lib/libapron.so
./lib/libapron_debug.a
./local/lib/ocaml/3.11.2/stublibs/dllapron_caml.so.owner
./local/lib/ocaml/3.11.2/stublibs/dllapron_caml.so
./local/lib/ocaml/3.11.2/apron
./local/lib/ocaml/3.11.2/apron/libapron_caml_debug.a
./local/lib/ocaml/3.11.2/apron/apron.cmxa
./local/lib/ocaml/3.11.2/apron/libapron_caml.a
./local/lib/ocaml/3.11.2/apron/apron.cmi
./local/lib/ocaml/3.11.2/apron/apron.cmx
./local/lib/ocaml/3.11.2/apron/apron.a
./local/lib/ocaml/3.11.2/apron/apron.cma

And I tried a first example:

(* with default setting:

apronppltop -I $MLGMPIDL_INSTALL/lib -I $APRON_INSTALL/lib

#load "gmp.cma";;
#load "apron.cma";;
#load "box.cma";;
#load "oct.cma";;
#load "polka.cma";;
#load "ppl.cma";;
#load "polkaGrid.cma";;

#install_printer Apron.Linexpr1.print;;
#install_printer Apron.Texpr1.print;;
#install_printer Apron.Lincons1.print;;
#install_printer Apron.Generator1.print;;
#install_printer Apron.Abstract1.print;;

let environment_print fmt x = Apron.Environment.print fmt x;;
let lincons1_array_print fmt x = Apron.Lincons1.array_print fmt x;;
let generator1_array_print fmt x = Apron.Generator1.array_print fmt x;;

#install_printer Apron.Var.print;;
#install_printer environment_print;;
#install_printer lincons1_array_print;;
#install_printer generator1_array_print;; *)
open Apron;;
...

However ocaml -c file.ml gives me Error: Unbound module Apron which happens on open Apron;;

Does anyone know why I could not load the Apron module? Thank you very much!

SoftTimur
  • 5,630
  • 38
  • 140
  • 292

1 Answers1

8

I should indicate the path of the Apron library with '-I' options. As it is installed in the standard library of OCaml, you only need to compile with:

ocamlc -I +apron -c file.ml

Benjamin Monate
  • 314
  • 2
  • 5
  • Thanks for your reply... I have tried `ocamlc -I +apron -c file.ml`, but the same error remains... I also tried `ocamlc -I /usr/lib/apron -c file.ml` and `ocamlc -I /usr/lib -c file.ml`, they did not work too... Do you see why? – SoftTimur Sep 20 '11 at 20:22
  • 2
    Why would `/usr/lib/apron` work? you did not even install the apron caml bindings in that directory. Try the full path to the directory where the apron's caml bindings are. – nlucaroni Sep 20 '11 at 21:05
  • @nlucaroni, thanks for your comment, I run `ocamlc -I /usr/local/lib/ocaml/3.11.2/apron -I /usr/local/lib/ocaml/3.11.2/gmp/ -c file.ml`, and it is much better. If you know a way to simplify that command, please let me know... – SoftTimur Sep 20 '11 at 21:41
  • Try findlib or use a Makefile/configure script to cache the path. – Chris Conway Sep 21 '11 at 01:34
  • There is something strange in your setup: what is printed by 'ocamlc -where'? – Benjamin Monate Sep 21 '11 at 05:36
  • @BenjaminMonate, `ocamlc -where` gives `/usr/lib/ocaml` – SoftTimur Sep 21 '11 at 11:07
  • 1
    '-I +apron -I +gmp' would be correct if the librarie were installed in /usr/lib/ocaml/apron and /usr/lib/gmp. Aren't there packages in your linux distribution that contain these libraries ? The install would be much more standard. You could also install ocaml and all other libraries through godi http://godi.camlcity.org/godi/index.html – Benjamin Monate Sep 22 '11 at 05:15