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.0 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE 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 4619EBBAF for ; Mon, 20 Oct 2008 15:51:34 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsDACsp/EjAXQImgWdsb2JhbACTbQEBFiKuCINs X-IronPort-AV: E=Sophos;i="4.33,451,1220220000"; d="scan'208";a="18300396" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Oct 2008 15:51:32 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m9KDpPY3012466 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 20 Oct 2008 15:51:32 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsDAB8q/EiK54gDgWdsb2JhbACTbQEBFiKuC4Ns X-IronPort-AV: E=Sophos;i="4.33,452,1220220000"; d="scan'208";a="30539171" Received: from rouge.crans.org ([138.231.136.3]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 20 Oct 2008 15:51:31 +0200 Received: from localhost (localhost.crans.org [127.0.0.1]) by rouge.crans.org (Postfix) with ESMTP id DE39B82E7; Mon, 20 Oct 2008 15:51:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at crans.org Received: from rouge.crans.org ([10.231.136.3]) by localhost (rouge.crans.org [10.231.136.3]) (amavisd-new, port 10024) with LMTP id shpociXWSz-N; Mon, 20 Oct 2008 15:51:30 +0200 (CEST) Received: from [88.185.141.188] (korell.glondu.net [88.185.141.188]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTP id 8B6128063; Mon, 20 Oct 2008 15:51:30 +0200 (CEST) Message-ID: <48FC8CE1.6020401@glondu.net> Date: Mon, 20 Oct 2008 15:51:29 +0200 From: =?UTF-8?B?U3TDqXBoYW5lIEdsb25kdQ==?= User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: guillaume.yziquel@bluebottle.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Compiling recursive modules into a .cma. References: <200810181507.m9IF7jLI025373@mi1.bluebottle.com> In-Reply-To: <200810181507.m9IF7jLI025373@mi1.bluebottle.com> X-Enigmail-Version: 0.95.0 OpenPGP: id=FCE03DAA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Miltered: at discorde with ID 48FC8CDD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 guillaume:01 cmo:01 makefile:01 wildcard:01 byte:01 cmo:01 byte:01 ocamlc:01 toplevel:01 cheers:01 phane:98 steph:98 phane:98 wrote:01 Hello, Guillaume Yziquel wrote: > I've been recently trying to compile a module I made. I can load the > .cmo I generate out of it, but not the .cma I generate out of it. > [...] >> # #load "ocaml-yziquel.cma";; >> Reference to undefined global `Protection' >> [...] IIUC, in this .cma, there are (at least) Protection and Chain modules, the latter depending on the former. However: > [...] > Here is the makefile: > [...] >> SOURCE =3D $(wildcard *.ml) >> [...] >> BYTE_COMPILED_OBJECT =3D $(SOURCE:.ml=3D.cmo) >> [...] >> ocaml-yziquel.cma: $(BYTE_COMPILED_INTERFACE) $(BYTE_COMPILED_OBJECT) >> $(OCAMLC) $(PACKAGES) -a -o ocaml-yziquel.cma $(BYTE_COMPILED_OBJECT)= >> [...] It seems that chain.cmo is linked before protection.cmo inside the .cma. The order of modules inside of a .cma file is important. The behaviour is the same as if they were #loaded in the same order in a toplevel. Try writing explicitly all .ml files of $(SOURCE) in topological order. Cheers, --=20 St=C3=A9phane