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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL 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 2C2D9BC69 for ; Wed, 28 Mar 2007 15:57:19 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SDvHvs005744 for ; Wed, 28 Mar 2007 15:57:18 +0200 Received: by nz-out-0506.google.com with SMTP id l8so2179383nzf for ; Wed, 28 Mar 2007 06:57:17 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CBltFZCX0kwaQ3n8ZBBFC56dmnijzEfu9HVq+tbZN1tSOgJs1rtJ/yGCvQm+roddMrWtnfI0fYBpclJIzv7za6AfiQgIX0ZGi/FX+GHx7oaZJh49fzafz/A6k2vLUYNuVXeoEPxQY+wtJ6aL25bts4U3x7hf2G9sCTyeqRpOMf4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=k9RDe846LdxrQKjzEwqgenGISCbRvFLWqyNLeodjC8n05zawz+NKkDLI88LClbScFm43DYbMKvJRXk8/bQzu6nj5SH0FNQMvxneoJ5MJ2NRv9JD6tKEvmbXL/Atr7rJYTNrdp2khPnqj1/n9SEfmt5kLgL7ZLe/kDKSYm6wGyw4= Received: by 10.115.58.1 with SMTP id l1mr3715322wak.1175090236512; Wed, 28 Mar 2007 06:57:16 -0700 (PDT) Received: by 10.114.183.4 with HTTP; Wed, 28 Mar 2007 06:57:16 -0700 (PDT) Message-ID: Date: Wed, 28 Mar 2007 15:57:16 +0200 From: "Nicolas Pouillard" To: "Joel Reymont" Subject: Re: [Caml-list] Producing a C wrapper with ocamlbuild or OMake Cc: "Caml List" In-Reply-To: <5FF6CDCC-AE05-472F-B721-782D32302EB7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <026CA3D4-5A8B-4083-B429-DE5AEC418C0A@gmail.com> <02DBCF0E-8CC6-44CC-B59D-31533A58C32A@gmail.com> <5FF6CDCC-AE05-472F-B721-782D32302EB7@gmail.com> X-j-chkmail-Score: MSGID : 460A743D.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 460A743D.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; -output-obj:01 ocaml:01 -output-obj:01 flags:01 deps:01 cmx:01 ocaml:01 compiler:01 cmx:01 ocamlfind:01 ocamlopt:01 -package:01 symtab:01 lexer:01 parser:01 Hum, -output-obj is more a link operation.... Using this rule: ... flag ["ocaml"; "link"; "output_obj"] (A"-output-obj"); (* I will make this one part of the standard set of flags *) rule "output C obj" ~deps:["%.cmx"; "%.o"] ~prod:"%caml.o" (Ocamlbuild_pack.Ocaml_compiler.native_link "%.cmx" "%caml.o"); ... Plus having this in your _tags <*caml.o>: output_obj Will works fine. On 3/28/07, Joel Reymont wrote: > Nicolas, > > I think I'm missing one more bit: > > ocamlbuild main > > + ocamlfind ocamlopt -package ounit -output-obj morpher.ml -o > morphercaml.o > No implementations provided for the following modules: > Symtab referenced from morpher.cmx > Ninja referenced from morpher.cmx > Easy_lexer referenced from morpher.cmx > Easy_parser referenced from morpher.cmx > Ppninja referenced from morpher.cmx > Pretty referenced from morpher.cmx > Parser_util referenced from morpher.cmx > Ninja_morph referenced from morpher.cmx > Command exited with code 2. > Compilation unsuccessful after building 2 targets (1 cached) in > 00:00:00. > > My complete plugin file is below. I can build my test program just > fine using > > ocamlbuild test.byte > > but trying to produce the library gives me the above error. > > What am I missing? How can I have morpher.ml automatically pull in > the other modules? > > I do open modules at the top of morpher.ml like this > > open Ninja_morph > open Parser_util > module PP = Ppninja > module N = Ninja > > > Thanks, Joel > > --- > > open Ocamlbuild_plugin;; > open Command;; > > let cc = A"cc";; > let ar = A"ar";; > let packages = "ounit" (* "pkg1,pkg2,..." *);; > > let ocamlfind cmd = > S[A"ocamlfind"; A cmd; A"-package"; A packages];; > > flag ["ocaml"; "link"] (A"-linkpkg");; > > dispatch begin function > | After_options -> > Options.ocamlc := ocamlfind "ocamlc"; > Options.ocamlopt := ocamlfind "ocamlopt"; > | After_rules -> > rule "output C obj" > ~dep:"%.ml" > ~prod:"%caml.o" > begin fun env _ -> > let caml_o = env "%caml.o" and ml = env "%.ml" in > Cmd(S[!Options.ocamlopt; A"-output-obj"; P ml; A"-o"; Px > caml_o]) > end; > rule "build C lib" > ~deps:["%_stubs.o"; "%caml.o"] > ~prod:"lib%.a" > begin fun env _ -> > let wrap_o = env "%wrap.o" > and caml_o = env "%caml.o" > and libasmrun = ! > *Ocamlbuild_pack.Ocaml_utils.stdlib_dir/"libasmrun.a" > and lib_a = env "lib%.a" in > Seq[cp libasmrun lib_a; > Cmd(S[ar; A"r"; Px lib_a; P caml_o; P wrap_o])] > end; > rule "build morpher" > ~deps:["libmorpher.a"; "main.o"] > ~prod:"main" > begin fun _ _ -> > Cmd(S[cc; P"morpher.o"; P"libmorpher.a"; A"-o"; Px"main"]) > end; > | _ -> () > end > > -- > http://wagerlabs.com/ > > > > > > -- Nicolas Pouillard