caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andrew Warshaver <awarshaver@janestcapital.com>
To: caml-list@yquem.inria.fr
Subject: ocamlbuild and c libraries
Date: Wed, 27 Jun 2007 12:14:07 -0400	[thread overview]
Message-ID: <46828CCF.20901@janestcapital.com> (raw)

For the most part I tried to follow Nicolas's example on the previous 
thread with similar name, but unfortunately I get an error that I do not 
entirely understand.

My target is intern/live_query/live_query.native.  It uses an ocaml/c 
library called jane that lives in janebase/lb (thanks Nicolas, for the 
renaming tip).  In there exists a jane.mlpack, and a libjane.clib.  Also 
there is a couple of _tags file:

$ cat janebase/lb/_tags
<*.cmx>: for-pack(Jane)
<*.cmo>: for-pack(Jane)
<jane.cmx>: -for-pack(Jane)
<jane.cmo>: -for-pack(Jane)
<cephes>: include
<jane.cm{x,}a>: use_libjane

$ cat intern/live_query/_tags
<{single,live}_query.{byte,native}>: use_jane (i also tried 
include_jane, this results in a different error message; in fact the 
same error if I omit this _tags altogether, it says undefined references 
in jane.o)

Also, myocamlbuild.ml :

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

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

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

let ocamlfind cmd =
   S [A "ocamlfind"; A cmd; A "-package"; A packages;
      A "-I"; A "+camlp4"; A "-pp"; A "camlp4orf";
      A "-pp"; A "camlp4o /home/awarshaver/multi-oc/lib/pa_type_conv.cmo 
/home/awarshaver/multi-oc/lib/pa_sexp_conv.cmo"];;

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 "jane";

       flag ["link"; "library"; "ocaml"; "byte"; "use_libjane"]
         (S[A"-dllib"; A"-ljane"; A"-cclib"; A"-ljane"]);

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

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

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

I can build the library ok...

$ ocamlbuild janebase/lb/jane.cmxa
+ ocamlfind c -package bigarray,pcre,res,netstring -I +camlp4 -pp 
camlp4orf -pp 'camlp4o /home/awarshaver/multi-oc/lib/pa_type_conv.cmo 
/home/awarshaver/multi-oc/lib/pa_sexp_conv.cmo' -c janebase/lb/cephes/main.c
janebase/lb/cephes/main.c: In function ‘main’:
janebase/lb/cephes/main.c:9: warning: control reaches end of non-void 
function
Finished, 286 targets (0 cached) in 00:01:12.

But not my target..

$ ocamlbuild intern/live_query/live_query.native
Solver failed:
   Ocamlbuild knows of no rules that apply to a target named jane.cmx. 
This can happen if you ask Ocamlbuild to build a target with the wrong 
extension (e.g. .opt instead of .native) or if the source files live in 
directories that have not been specified as include directories.
Backtrace:
   - Failed to build the target intern/live_query/live_query.native
       - Building intern/live_query/live_query.native:
           - Building jane.a:
               - Failed to build all of these:
                   - Building jane.cmx
                   - Building jane.mllib
Compilation unsuccessful after building 358 targets (358 cached) in 
00:00:28.

Insights appreciated!

Thanks,
Andrew


             reply	other threads:[~2007-06-27 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27 16:14 Andrew Warshaver [this message]
2007-06-27 16:35 ` [Caml-list] " Andrew Warshaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46828CCF.20901@janestcapital.com \
    --to=awarshaver@janestcapital.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).