Search code examples
compiler-errorsocamllibsvmlapack

Unable to use libsvm with OCaml


I tried to use libsvm in an OCaml project :

open Lacaml.D
open Libsvm

However, I am facing this strange bug when I try to run my makefile :

ocamlfind: Error from package `threads': Missing -thread or -vmthread switch

My makefile being :

ocamlfind ocamlopt -o prog -linkpkg -package lacaml -package libsvm Example1.ml

I made sure all the packages were present (using depext) :

# Installed packages for system:
base-bigarray             base  Bigarray library distributed with the OCaml compiler
base-bytes                base  Bytes library distributed with the OCaml compiler
base-ocamlbuild           base  OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads              base  Threads library distributed with the OCaml compiler
base-unix                 base  Unix library distributed with the OCaml compiler
[...]
lacaml                   8.1.1  OCaml-bindings to BLAS and LAPACK.
lbfgs                    0.8.8  Minimization of multidimensional functions on bounded or unbounded domains.
libsvm                   0.9.3  LIBSVM bindings for OCaml

Solution

  • You have to instruct ocamlfind to select the thread libs by gving it the option -thread or -vmthread - see ocamlfind