From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4JBYq92008423 for ; Thu, 19 May 2011 13:34:52 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0DAFD/1E3RVdQ0kGdsb2JhbACXXzGNdQgUAQEBAQkJDQcUBCGseIwagjWEfzeIYgEBAwaGEwSQEYhIA4I6O4M3 X-IronPort-AV: E=Sophos;i="4.65,237,1304287200"; d="scan'208";a="108970416" Received: from mail-vw0-f52.google.com ([209.85.212.52]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 19 May 2011 13:34:46 +0200 Received: by vws16 with SMTP id 16so3331666vws.39 for ; Thu, 19 May 2011 04:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=LACTqP6M9CZ7dD0mozfRXzToCyBAszvPVim8qzql7j8=; b=pT/w2pA+w0azbGUnMevXLgLJ5jURTV26QqUvQzAKvQGRGJBUCO5pEum+OlqG+MPS71 h6DYgcFMIyOXau89mGuuozMofwoe2eiVzl/PWm6I5sggsomnTlqsz3InwS/CDaau4IUB wNZcSfdYJO9tNH/rLGMNp4pduZXuqHW1iENWw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=t3x1qMxGtTQu48YlVrGylPyOW/DbL0Zupz48P0VWUP8k7kFSl+H2o8HyDc1vG/d7gV m4m9ZO7ESRxfJCSo3iHR+YFiSUTqXIEGXMq3iblNHhtS85VJYTyUsRUKYqBtQPoQ5yWu IfaJ8IkkBXncPfaP8qc1NP7IE2ZId9CT2LISI= Received: by 10.52.100.7 with SMTP id eu7mr4268045vdb.296.1305804885157; Thu, 19 May 2011 04:34:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.165.74 with HTTP; Thu, 19 May 2011 04:34:25 -0700 (PDT) In-Reply-To: <4DD4F5DB.4020402@gmail.com> References: <4DD4F5DB.4020402@gmail.com> From: Gabriel Scherer Date: Thu, 19 May 2011 13:34:25 +0200 Message-ID: To: matthieu.dubuget@gmail.com Cc: Caml Mailing List Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p4JBYq92008423 Subject: Re: [Caml-list] Ocamlbuild question The problem is that xml-light has a weird module dependency graph. xml.ml depends on Dtd, while dtd.ml and dtd.mli depend on Xml. I'm not sure the way this is done, but I think it is very hackish. The way I understand it (and I am probably wrong), xml.mli is first compiled as an signature-alone module (without implementation; you may have .mli without attached .ml), against which Dtd is compiled, then the xml.ml file is compiled as a *different* Xml module (yes, this sounds crazy), and it reuses the types from the xml.mli interface by casting them using Obj.magic. I don't know why this is done that way. I suppose this is some kind of hack to have recursive modules without saying it. Anyway, it's much too hackish for any reasonable dependency solver to understand. I think keeping your old build script is probably the best solution here. I don't know much about ocamlbuild plugin language, maybe it's possible to override the default dependency solver completely to provide your own build order (I know it's possible to change it by adding constraints), but I don't think you would gain much by this approach. On Thu, May 19, 2011 at 12:50 PM, Matthieu Dubuget wrote: > Hello, > > I'm trying to build xml-light using ocamlbuild (don't ask me why, I do not > know myself…) > > The standard way for building xml-light.cma is working (with a patch stolen > from debian package): > >> wget http://tech.motion-twin.com/zip/xml-light-2.2.zip >> unzip xml-light-2.2.zip >> cd xml-light >> sed -i -e 's/.mly.ml:/%mli %ml: %mly/' Makefile >> make xml-light.cma > > >> ... >> >> ocamlyacc xml_parser.mly >> ocamlc xml.mli >> ocamlc dtd.mli >> ocamlc xml_parser.mli >> ocamlc -c xml_parser.ml >> ocamllex xml_lexer.mll >> 228 states, 1162 transitions, table size 6016 bytes >> ocamlc xml_lexer.mli >> ocamlc -c xml_lexer.ml >> ocamlc -c dtd.ml >> ocamlc xmlParser.mli >> ocamlc -c xmlParser.ml >> ocamlc -c xml.ml >> ocamlc -o xml-light.cma -a xml_parser.cmo xml_lexer.cmo dtd.cmo >> xmlParser.cmo xml.cmo > > Here is my try with ocamlbuild: > >> wget http://tech.motion-twin.com/zip/xml-light-2.2.zip >> unzip xml-light-2.2.zip >> cd xml-light >> for d in Xml_parser Xml_lexer Dtd XmlParser Xml; >> do echo "$d" >> xml-light.mllib; >> done >> ocamlbuild xml-light.cma >> ls _build/*.cmo > >> ... >> >> Circular dependencies: "dtd.cmo" already seen in >> [ "xml.cmo"; "dtd.cmo"; "xml_parser.cmo" ] >> >> Compilation unsuccessful after building 22 targets (0 cached) in 00:00:00. >> _build/dtd.cmo _build/xml.cmo _build/xml_lexer.cmo _build/xml_parser.cmo >> _build/xmlParser.cmo > > I would like to understand the origin of the problem? > > Salutations > > Matthieu > > > > -- > Caml-list mailing list.  Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >