Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OCaml Compile Error: /usr/bin/ld: cannot find -lstr

I am trying to compile the source code of MEGAM Ocaml library on an Ubuntu 64 machine.

I have OCaml installed (v 3.12.1), using sudo apt-get install ocaml.

I am having an issue when running the "make" command in the terminal on the unzipped source code, with OCaml returning the error:

/user/bin/ld: cannot find -lstr
collect2: error: ld returned 1 exit status

The makefile is producing the following two commands:

 ocamldep *.ml > .depend

No error when run

ocamlc -g -custom -o megam str.cma -cclib -lstr bigarray.cma -cclib -lbigarray unix.cma -cclib -lunix -I /usr/lib/ocaml/caml fastdot_c.c fastdot.cmo intHashtbl.cmo arry.cmo util.cmo data.cmo bitvec.cmo cg.cmo wsemlm.cmo bfgs.cmo pa.cmo perceptron.cmo radapt.cmo kernelmap.cmo abffs.cmo main.cmo

Throws the error above when run.

I've tried removing the -lstr from the compile command, it stopped throwing that particular error but started throwing another error (Reference to undefined global 'Bigarray'), which is making me thing it might all be something I missed during the OCaml installation, some kind of PATH or reference I needed to set.

Any help is really appreciated, even if its just a shot in the dark, as am really struggling to come up with anything!

like image 593
ToOsIK Avatar asked Nov 27 '12 12:11

ToOsIK


2 Answers

You could just change the makefile from

-lstr

to

-lcamlstr
like image 191
user3760483 Avatar answered Nov 04 '22 09:11

user3760483


The instructions given here allow me to compile with no error. It boils down to:

locate libcamlstr

which tells me that libcamlstr can be found in /usr/lib/ocaml (YMMV), so I do:

cd /usr/lib/ocaml
sudo ln -s libcamlstr.a libstr.a

Then I'm able to compile the project:

cd /usr/local/src/cil
make clean && ./configure && make
like image 16
jrouquie Avatar answered Nov 04 '22 09:11

jrouquie