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 B8ADABC6C for ; Thu, 31 Jan 2008 14:41:09 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAINeoUfAXQInh2dsb2JhbACQKwEBAQgKKZoQ X-IronPort-AV: E=Sophos;i="4.25,285,1199660400"; d="scan'208";a="8573369" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 31 Jan 2008 14:41:09 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0VDf89k014743 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 31 Jan 2008 14:41:08 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAADJfoUeBrw8Eh2dsb2JhbACQKwEBAQgKKZoN X-IronPort-AV: E=Sophos;i="4.25,285,1199660400"; d="scan'208";a="22016678" Received: from ext.lri.fr ([129.175.15.4]) by mail4-smtp-sop.national.inria.fr with ESMTP; 31 Jan 2008 14:41:08 +0100 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id E4FD2A492D; Thu, 31 Jan 2008 14:41:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QDZ0u3K1l8lA; Thu, 31 Jan 2008 14:41:07 +0100 (CET) Received: from smtp.lri.fr (vhost3-23 [129.175.3.23]) by ext.lri.fr (Postfix) with ESMTP id B1900A4915; Thu, 31 Jan 2008 14:41:07 +0100 (CET) Received: from [129.175.4.128] (lri4-128 [129.175.4.128]) by smtp.lri.fr (Postfix) with ESMTP id 92EF7E0516; Thu, 31 Jan 2008 14:41:07 +0100 (CET) Message-ID: <47A1D046.2040908@lri.fr> Date: Thu, 31 Jan 2008 14:42:30 +0100 From: Romain Bardou User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Nicolas Pouillard Cc: caml-list Subject: Re: [Caml-list] ocamlbuild and packs References: <47A1B728.1070200@lri.fr> <1201784124-sup-1877@ausone.inria.fr> In-Reply-To: <1201784124-sup-1877@ausone.inria.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 47A1CFF4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lri:01 utils:01 ocaml:01 subdirectory:01 cmo:01 cmo:01 cmx:01 -for-pack:01 -for-pack:01 summarized:01 -pack:01 makefile:01 makefile:01 byte:01 byte:01 Thanks for your help! Now it still doesn't compile, but the error is different and shows that I'm getting closer. What I didn't tell you is that I actually have several directories "bla", so it is more like this: module A module C module bla/A module bla/B module bli/C module Main You can view the "bla" and "bli" directories as the "parsing" and "utils" directories of the OCaml source. The module bla/A depends on the module bli/C. There is no clash between names in the directories bla and bli, and I want to pack bla and bli together in a big module Blabli so Main can access Blabli.A, Blabli.B and Blabli.C. So I have a file blabli.mlpack: bla/A bla/B bli/C The problem is that ocamlbuild doesn't look in bli to compile the files in bla, so I get an error while compiling bla/A: the module bli/C is unbound. I guess one possible solution would be to put all the files in "bla" and in "bli" together in the same directory, but I'd really prefer to avoid that if possible. I tried it and it works, though: when I put every file in the same subdirectory, the following command works, and produces the file _build/bla.cmo: ocamlbuild bla.cmo However, the following command doesn't work: ocamlbuild bla.cmx Because the files aren't compiled with the -for-pack option. I have to add "-cflags -for-pack,Bla". I guess it shouldn't be hard to use the _tags file to make it use the flag only on the files of bla, so I'll try and investigate that (couldn't it be automatic though?). Thanks again, Romain Bardou Nicolas Pouillard a écrit : > Excerpts from Romain Bardou's message of Thu Jan 31 12:55:20 +0100 2008: >> Hello, > Hello, > >> I have this big project I work on, which could be summarized like this: >> >> module A >> module bla/A >> module bla/B >> module Main >> >> The module B in the bla directory depends on the module A of the bla >> directory. The module Main depends on both modules A and on module B. >> For some reasons I cannot rename either of the modules. >> >> So what I do is pack A and B in a Bla module, so I can write Bla.A and >> Bla.B, using the -pack command line option. It works with my Makefile. >> >> Now I try to use ocamlbuild, because I really like its approach (I come >> from the Pascal world where no makefile is needed). So I made this file >> bla.mlpack containing the lines: >> >> A >> B > > bla.mlpack should not be in the bla/ directory, and should contain: > > bla/A > bla/B > > Because you don't want to expose bla to all your modules since you have a name clash. > >> Now if I compile using: >> >> ocamlbuild Main.byte > > Does it works now? > > [...] > >> I can't compile using: >> >> ocamlbuild -I bla Main.byte >> >> Because now the module A is defined twice. > > Yes > >> So I tried to compile using two steps: first, compile bla.cmo, and then, >> compile Main.byte, but ocamlbuild doesn't seem to be good at that (and >> actually that's not a bad thing imo). Indeed, if I do: >> >> ocamlbuild bla.cmo > > You won't trick ocamlbuild with this technique, but it's a good way to > specifically found what's should be buildable and is not. > > [...] > >> Now for the questions: >> 1) What is the best way to compile my project? By "best" I mean: with no >> plugin if possible, with a small _tags file, and as few command line >> options as possible, while still keeping the spirit of ocamlbuild (for >> instance, compiling everything in one single call to ocamlbuild if >> possible). > > In most of cases it will works. However precise directory scopes and packages > contents and scope can be done in a plugin. > >> 2) Why doesn't ocamlbuild compile my file bla.mlpack into bla.cmo? In >> the manual I can read that "%.mlpack" has target "%.cmo". > > Yes there is such a rule. > >> 3) If ocamlbuild actually did compile bla.cmo, could it use it to >> compile main.byte or must I build a library bla.cma first? > > Yes it will use it. > >> Thanks. I would be glad to contribute to the wiki, but I have to >> understand ocamlbuild first ;) > > I would be thankful. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs