ELINA icon indicating copy to clipboard operation
ELINA copied to clipboard

failed compilation of ocaml target

Open monniaux opened this issue 7 years ago • 6 comments

Make in ocaml_interface fails due to path to libraries not being correctly set. ocamlopt.opt -g -I /home/monniaux/.opam/4.04.0/lib/gmp -I /home/monniaux/.opam/4.04.0/lib/apron -o mlexample.opt bigarray.cmxa gmp.cmxa apron.cmxa elina_poly.cmxa mlexample.ml /usr/bin/ld: cannot find -lelina_poly_caml /usr/bin/ld: cannot find -loptpoly /usr/bin/ld: cannot find -lcamlidl collect2: error: ld returned 1 exit status File "caml_startup", line 1: Error: Error during linking Makefile:87: recipe for target 'mlexample.opt' failed

monniaux avatar Mar 29 '17 16:03 monniaux

I'm seeing the same thing.

smagill avatar Apr 17 '17 18:04 smagill

Hi all,

Specify the location of the libraries in the CAML_LD_LIBRARY_PATH variable in ocaml_interface/Makefile (updated). Let me know if it works.

Cheers, Gagan

GgnDpSngh avatar Apr 18 '17 16:04 GgnDpSngh

I'm still having trouble with this. It seems that CAML_LD_LIBRARY_PATH was replaced with LD_LIBRARY_PATH, and this variable in master is set to:

export LD_LIBRARY_PATH=.:../elina_poly:

which is where liboptpoly.so lives. However, I'm still getting the following error:

/usr/bin/ld: cannot find -loptpoly

(I am also still getting /usr/bin/ld: cannot find -lelina_poly_caml, but I haven't updated LD_LIBRARY_PATH appropriately for this library).

Isweet avatar Jun 07 '17 17:06 Isweet

Hi Ian,

Did you try setting the LD_LIBRARY_PATH before calling make? Can you specify the compiler version and the operating system on your machine?

Cheers, Gagan

GgnDpSngh avatar Jun 07 '17 20:06 GgnDpSngh

The LD_LIBRARY_PATH is already set to include the directory in which liboptpoly.so resides. So I expect that even without modifying this variable, I should not get the error that I mentioned above.

That being said, I did try to modify this variable to also include the location of the libelina_poly_caml library, and still got the same errors.

I am using Debian 3.16.43-2, with gcc version 4.9.2.

Thanks,

Ian

Isweet avatar Jun 08 '17 16:06 Isweet

Hello,

I sent a pull request #31 , in which liboptpoly.so and the other shared objects are compiled with the rpath option, so they can be found at runtime, after the installation. I hope this help.

I think the easiest way is to install using opam. (From the above command, I assumed you installed Apron and the other dependencies using opam.)

$ opam pin add elina .
$ cd ocaml_interface
$ ocamlopt.opt -g -I `ocamlfind query gmp` -I `ocamlfind query apron` -I `ocamlfind query elina` -o mlexample.opt bigarray.cmxa gmp.cmxa apron.cmxa elina_poly.cmxa mlexample.ml
$ ./mlexample.opt

or you may be able to install Elina to your own directory (e.g. ~/install in this example):

$ ./configure -use-opam -use-apron --prefix ~/install --apron-prefix `opam config var share`/apron
$ make
$ make install
$ cd ocaml_interface
$ ocamlopt.opt -g -I `ocamlfind query gmp` -I `ocamlfind query apron` -I ~/install/lib -o mlexample.opt bigarray.cmxa gmp.cmxa apron.cmxa elina_poly.cmxa mlexample.ml
$ ./mlexample.opt

I tested this on Debian GNU/Linux 9 (stretch) and gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516.

Sincerely, Sungkeun

skcho avatar Jul 18 '18 08:07 skcho