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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1D2FBBBC1 for ; Wed, 26 Mar 2008 00:17:26 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYCAFMk6UeBCnQzbmdsb2JhbACRH5lt X-IronPort-AV: E=Sophos;i="4.25,555,1199660400"; d="scan'208";a="10669909" Received: from amber.ccs.neu.edu ([129.10.116.51]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Mar 2008 00:17:25 +0100 Received: from c-24-60-10-50.hsd1.ma.comcast.net ([24.60.10.50] helo=localhost) by amber.ccs.neu.edu with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.50) id 1JeIOH-0000Pr-59; Tue, 25 Mar 2008 19:17:13 -0400 Date: Tue, 25 Mar 2008 19:17:12 -0400 From: Richard Cobbe To: caml-list@yquem.inria.fr Subject: Trouble with "ocamlbuild main.native" Message-ID: <20080325231712.GB86489@perdita.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam: no; 0.00; ocaml:01 mli:01 mli:01 parser:01 parser:01 mll:01 cmo:01 byte:01 ocamlfind:01 ocamlopt:01 -package:01 camomile:01 -pack:01 cmx:01 cmx:01 I'm having some difficulty getting ocamlbuild to produce native binaries for a project that's spread over multiple directories. I'm hoping someone can explain what I'm doing wrong here. Mac OS X 10.5.2, intel, all updates. OCaml 3.10.2, ocaml-lib 1.4, ocaml-findlib 1.1.2 (all packaged by Fink) My project includes several files spread over multiple directories. The structure is roughly as follows: main.ml codeGen.ml codeGen.mli backEnd.mlpack frontEnd.mlpack dataRep.mlpack backEnd/translate.ml backEnd/translate.mli backEnd/thunk.ml backEnd/thunk.mli frontEnd/parser.ml frontEnd/parser.mli frontEnd/scanner.mll frontEnd/scanner.mli dataRep/ast.ml dataRep/astFold.mli dataRep/astFold.ml and so on. The directories contain additional modules beyond those I'm listing here. The mlpack files contain bare module names. That is, backEnd.mlpack contains Translate Thunk and so forth. I do not have a _tags file. I do have a myocamlbuild.ml file, which is included below. This is merely supposed to load in a couple of additional libraries that were installed via ocaml-findlib. Unfortunately, this file is black magic to me -- I copied it off someone's web page and edited only the list of packages. I certainly don't understand how it works, and I don't know whether this is the Right Way to do this. When I run "ocamlbuild main.cmo" from the top-level directory, everything builds fine. I can also run "ocamlbuild main.byte". I cannot, however, run "ocamlbuild main.native"; I get the following error message: $ ocamlbuild main.native + touch dataRep.mli ; if ocamlfind ocamlopt -package oUnit,camomile,unix -pack -I dataRep dataRep/srcloc.cmx dataRep/symbol.cmx dataRep/unicodeString.cmx dataRep/ast.cmx dataRep/astFold.cmx -o dataRep.cmx ; then rm -f dataRep.mli ; else rm -f dataRep.mli ; exit 1; fi File dataRep/srcloc.cmx was not compiled with the `-for-pack DataRep' option Command exited with code 1. Based on the thread at , I tried creating a _tags file: : for-pack(frontEnd) : for-pack(backEnd) : for-pack(dataRep) But this doesn't work either: $ ocamlbuild main.native + /sw/bin/ocamldep.opt -for-pack dataRep -modules dataRep/ast.ml > dataRep/ast.ml.depends /sw/bin/ocamldep.opt: unknown option `-for-pack'. It's not a major concern, since I can get by with the bytecode build, but I would like to know how to build the native binary. What am I missing? Many thanks, Richard myocamlbuild.ml: open Ocamlbuild_plugin;; open Command;; (* written using a comma separated list *) let packages = "oUnit,camomile,unix";; let ocamlfind x = S[A"ocamlfind"; x; A"-package"; A packages];; dispatch begin function | Before_options -> Options.ocamlc := ocamlfind& A"ocamlc"; Options.ocamlopt := ocamlfind& A"ocamlopt"; | After_rules -> flag ["ocaml"; "link"] (A"-linkpkg") | _ -> () end;;