From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: matthieu.dubuget@gmail.com
Cc: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Ocamlbuild question
Date: Thu, 19 May 2011 13:34:25 +0200 [thread overview]
Message-ID: <BANLkTine2aJ-OFbJQe9261jvO5XYTmdnOA@mail.gmail.com> (raw)
In-Reply-To: <4DD4F5DB.4020402@gmail.com>
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
<matthieu.dubuget@gmail.com> 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
>
>
next prev parent reply other threads:[~2011-05-19 11:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 10:50 Matthieu Dubuget
2011-05-19 11:34 ` Gabriel Scherer [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-02-11 22:26 Matthieu Dubuget
2009-02-12 16:00 ` [Caml-list] " Nicolas Pouillard
2009-02-12 17:32 ` Matthieu Dubuget
2009-02-12 18:33 ` Matthieu Dubuget
2009-02-13 10:56 ` Matthieu Dubuget
2009-02-13 16:06 ` Matthieu Dubuget
2009-02-16 13:07 ` Matthieu Dubuget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTine2aJ-OFbJQe9261jvO5XYTmdnOA@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=matthieu.dubuget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox