I have installed some libraries, and am trying to compile a code.
1) ocamlc -I /usr/lib -I /usr/local/lib/ocaml/3.11.2/apron -I /usr/local/lib/ocaml/3.11.2/gmp -c mlexample2.ml generates well mlexample2.cmi and mlexample2.cmo
2) ocamlopt -I /usr/lib -I /usr/local/lib/ocaml/3.11.2/apron -I /usr/local/lib/ocaml/3.11.2/gmp -o mlexample2.opt generates well mlexample2.cmx
3) However, If I follow the native-code compilation of this page:
ocamlopt -I /usr/lib -I /usr/local/lib/ocaml/3.11.2/apron -I /usr/local/lib/ocaml/3.11.2/gmp -o mlexample2.opt \ bigarray.cmxa gmp.cmxa apron.cmxa boxMPFR.cmxa polkaMPQ.cmxa mlexample2.ml returns File "mlexample2.ml", line 1, characters 0-1: Error: Cannot find file bigarray.cmxa, where usr/lib represents $APRON/lib in the doc. But big.array.cmxa is effectively in /usr/lib/ocaml/bigarray.cmxa. By the way, this command does generate .cmi, .cmx and .o.
So my questions are:
How could I progress from .cmi and .cmo of 1)?
How could I progress from .cmx of 2)
What can I do with the error in 3)
Could anyone help? Thank you very much!
Edit1: 2) should be: ocamlopt -I /usr/lib -I /usr/local/lib/ocaml/3.11.2/apron -I /usr/local/lib/ocaml/3.11.2/gmp -c mlexample2.ml generates .cmi, .cmx and .o.
From your other questions, it seems like you got some sample lines to compile and just blindly walking though without understanding the compile options.
1) You’re compile line has the
-coption. This option does not link, thus it allows someone to compile an individual module and link them later. This is helpful to allow the project to be built in pieces and updated in pieces for quicker final compilation. So, the-coption passed to ocamlc produces yourcmiandcmo, byte-code complied module.2) You are missing something here in your sample compile line –it doesn’t mention anything regarding to produce an additional file. I’m going to assume that you also use the
-coption. This is because a.cmxis also a compiled module, but natively compiled via ocamlopt.3) This should be a pretty obvious compilation error to fix. Where in your included directories does
bigarry.cmxareside? None of them. You’ve said it yourself that it is in/usr/lib/ocaml/, a directory you did not include! The directories do not search recursively, and you’ve experienced that before in other questions.I strongly suggest you read the manual on compilation. This documentation you’re wading through is correct in how to compile, but you’ve set your environment up in a different way and discerning the differences is going to be frustrating until you get a handle on what those commands are actually doing.