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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 01A6FBC37 for ; Tue, 14 Jul 2009 00:52:13 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUCAD1XW0rU4xEKlGdsb2JhbACBUY0WikEBAQEBCQsICRMDtW0ChAcF X-IronPort-AV: E=Sophos;i="4.42,393,1243807200"; d="scan'208";a="43383455" Received: from moutng.kundenserver.de ([212.227.17.10]) by mail4-smtp-sop.national.inria.fr with ESMTP; 14 Jul 2009 00:52:13 +0200 Received: from office1.lan.sumadev.de (dslb-084-059-064-065.pools.arcor-ip.net [84.59.64.65]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MKt72-1MQUNW3btt-0009Vy; Tue, 14 Jul 2009 00:52:11 +0200 Received: from [192.168.5.104] (dslb-084-059-064-065.pools.arcor-ip.net [84.59.64.65]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 97C2BC0F0D; Tue, 14 Jul 2009 00:52:10 +0200 (CEST) Subject: Re: [Caml-list] Virtual packages in findlib From: Gerd Stolpmann To: Dario Teixeira Cc: caml-list@yquem.inria.fr, Stefano Zacchiroli In-Reply-To: <379032.5491.qm@web111513.mail.gq1.yahoo.com> References: <379032.5491.qm@web111513.mail.gq1.yahoo.com> Content-Type: text/plain Date: Tue, 14 Jul 2009 00:55:43 +0200 Message-Id: <1247525743.15577.21.camel@flake.lan.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+A/1aNtTjS/lRGSLz7qFzkSG7K5GnvbiJfLT6 zlSyf+3/DFd5nV6mud/nXBFrb91GoPDx4EK3cvTTcTENz5gmS4 D68Wa0GsynJOw9LY+x1gw== X-Spam: no; 0.00; findlib:01 gerd:01 stolpmann:01 gerd:01 dependencies:01 findlib:01 dependencies:01 re-order:01 -predicates:01 -predicates:01 subpackages:01 subpackages:01 byte:01 byte:01 orthogonal:01 Am Mittwoch, den 08.07.2009, 03:35 -0700 schrieb Dario Teixeira: > Hi, > > > Can you explain that? I don't see why virtual packages can resolve > > ordering problems. > > Because without virtual packages, one cannot list the true dependencies > of a package, thus causing ordering problems. > > Consider the minimal example of there being two packages: A and B, with > B depending on A, and therefore having to be linked after. However, A is > not a real package, but instead a virtual one instantiated by either > A1, A2, A3, etc. > > But alas, there is no virtual package support in findlib (I assume). > Because of this, the META file for B does not list A as a dependency. > (Yes, the META is "wrong", but how could it be made right?) > > Now, we tell ocamlbuild that the project depends on A1 (for instance) and B. > Because there is no *declared* dependency between A1 and B (though in fact > there should be), ocamlbuild probably assumes that it is indifferent to > link "A1; B" or "B; A1". However, the latter case will cause an error. > > Therefore, there are two solutions to this problem: > > a) Make ocamlbuild preserve the order of the given packages *when there > is no explicit dependency among them*. (Obviously if there are dependencies > then Ocamlbuild should re-order the packages as fit). > > b) Find some virtual package mechanism in findlib (thus rendering the > hack a) moot). Well, you can make dependencies conditional using the predicate feature. In B you can write: requires(P_A1) = "A1" requires(P_A2) = "A2" etc. and when linking you have to select which dependency to take by giving the right -predicates switch: e.g. -predicates P_A1. Also, there are subpackages (useful when you want to put A1 and A2 into the same directory). So you can create a fancy package A with subpackages A1 and A2 like: requires(P_A1) = "A.A1" requires(P_A2) = "A.A2" requires = "A.A1" (* default *) package "A1" ( (* definitions for A1 *) requires = ... archive(byte) = ... archive(native) = ... ) package "A2" ( (* definitions for A2 *) requires = ... archive(byte) = ... archive(native) = ... ) And B simply lists A as dep, and A is dependent on either A.A1 or A.A2, as given by predicates. This is not really a virtual package as you describe it. It was developed to support several versions of the same package, e.g. one version with enabled debugging, and the other without. The predicates work more or less orthogonal to the dependency graph. Gerd > > Cheers, > Dario Teixeira > > > > > > _______________________________________________ > 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 > -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------