Version française
Home     About     Download     Resources     Contact us    
Browse thread
missing library on .native using ocamlbuild
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrew Warshaver <awarshaver@j...>
Subject: missing library on .native using ocamlbuild
Hello,

I'm trying to compile a program called live_query, to native code. 
After I finally got ocamlbuild to be happy, now when I run it I get a 
complaint of a missing library.  I was under the (apparently false) 
impression that after one compiles to native code no more linking needs 
to be done.

My error message:
$ ./live_query.native
./live_query.native: error while loading shared libraries: liblbm.so.1: 
cannot open shared object file: No such file or directory

I actually do have access to this library; it should not a problem to 
link it in, but I do not know how to tell ocamlbuild either to look at a 
specific spot at runtime for this library or to force it linked in at 
compile time.

Please help if you might know why :)  Thanks you!

Andrew

I also include my myocamlbuild.ml:

$ cat myocamlbuild.ml
open Ocamlbuild_plugin;;
open Command;;

let packages = "bigarray,pcre,res,netstring";;

let janeheaders = ["janebase/lb/cephes/mconf.h"; 
"janebase/lb/cephes/protos.h"; "janebase/lb/ocaml_utils.h"];;

let ocamlfind cmd =
   S [A "ocamlfind"; A cmd; A "-package"; A packages];;

flag ["ocaml"; "compile"] (A"-thread");;
flag ["ocaml"; "link"; "program"] (S[A"-linkpkg"; A"-thread"]);;

dispatch begin function
   | After_options ->
       Options.ocamlc := ocamlfind "c";
       Options.ocamlopt := ocamlfind "opt";
       Options.ocamldep := ocamlfind "dep";
   | After_rules ->
       ocaml_lib "janebase/lb/jane";
       ocaml_lib "lbm/lb/lbm";

       flag ["link"; "library"; "ocaml"; "byte"; "use_libjane"]
         (S[
            A"-ccopt"; A"-Ljanebase/lb";
            A"-dllpath"; A"janebase/lb";
            A"-dllib"; A"-ljane"; A"-ccopt"; A"-ljane"]);

       flag ["link"; "library"; "ocaml"; "native"; "use_libjane"]
         (S[A"-cclib"; A"-Ljanebase/lb"; A"-cclib"; A"-ljane"]);

       flag ["link"; "library"; "ocaml"; "byte"; "use_liblbm"]
         (S[
           A"-ccopt"; A"-Llbm/lb"; A"-ccopt"; A"-llbm_stubs";
           A"-dllpath"; A"lbm/lb"; A"-dllib"; A"-llbm_stubs";
           A"-cclib"; A"-L/opt/lbm-3.0/Linux-2.4-glibc-2.3-i686/lib";
           A"-cclib"; A"-llbm"]);

       flag ["link"; "library"; "ocaml"; "native"; "use_liblbm"]
         (S[A"-cclib"; A"-Llbm/lb"; A"-cclib"; A"-llbm_stubs";
            A"-cclib"; A"-L/opt/lbm-3.0/Linux-2.4-glibc-2.3-i686/lib";
            A"-cclib"; A"-llbm"]);

       flag ["compile"; "liblbm_headers"]
         (S[A"-ccopt"; A"-I/opt/lbm-3.0/Linux-2.4-glibc-2.3-i686/include"]);

       dep ["link"; "ocaml"; "use_libjane"] ["janebase/lb/libjane.a"];
       dep ["link"; "ocaml"; "use_liblbm"] ["lbm/lb/liblbm_stubs.a"];

       dep ["sexp_pp"] ["janebase/sexp/lib/pa_sexp_conv.cmo"; 
"type-conv/pa_type_conv.cmo"];

       dep ["compile"; "c"; "libjane_headers"] janeheaders;
   | _ -> ()
end