From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B2A37BC6B for ; Wed, 27 Jun 2007 18:14:10 +0200 (CEST) Received: from smtp.janestcapital.com (www.janestcapital.com [66.155.124.107]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5RGE9oC032219 for ; Wed, 27 Jun 2007 18:14:10 +0200 Received: from [172.25.131.129] [38.96.172.125] by janestcapital.com (SMTPD-9.10) id ACE10214; Wed, 27 Jun 2007 12:14:25 -0400 Message-ID: <46828CCF.20901@janestcapital.com> Date: Wed, 27 Jun 2007 12:14:07 -0400 From: Andrew Warshaver User-Agent: Thunderbird 2.0.0.0 (X11/20070505) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: ocamlbuild and c libraries Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-IMAIL-SPAM-VALFROM: (8ce1014900001203) X-IMAIL-SPAM-VALREVDNS: (8ce1014900001203) X-Miltered: at discorde with ID 46828CD1.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; intern:01 ocaml:01 cmx:01 cmo:01 cmx:01 -for-pack:01 cmo:01 -for-pack:01 intern:01 byte:01 bigarray:01 pcre:01 netstring:01 ocamlfind:01 ocamlfind:01 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) : -for-pack(Jane) : -for-pack(Jane) : include : 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