eth-sri / ELINA

ELINA: ETH LIbrary for Numerical Analysis
http://elina.ethz.ch/
Other
129 stars 54 forks source link

failed compilation of ocaml target #7

Open monniaux opened 7 years ago

monniaux commented 7 years ago

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

smagill commented 7 years ago

I'm seeing the same thing.

GgnDpSngh commented 7 years ago

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

Isweet commented 7 years ago

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).

GgnDpSngh commented 7 years ago

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

Isweet commented 7 years ago

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

skcho commented 6 years ago

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