Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] ocamlbuild and pack

25 views
Skip to first unread message

Johannes Kanig

unread,
Sep 9, 2008, 9:38:17 AM9/9/08
to caml...@inria.fr
Hi List,

I have the following problem. I have three files, each consisting of one
line:

a.ml: type t = float
b.ml: type t = A.t
c.ml: include B

Now I want to put these modules into a pack, but I only want to export A and
C, so I write a file project.mli:
module A : sig type t end
module C : sig type t = A.t end

As I want to use ocamlbuild, I also create a file project.mlpack:
A
C

Now, the command "ocamlbuild project.cmo" works fine, but I can't build a
library from that:
ocamlbuild project.cma
Circular dependencies: "project.cmo" already seen in
[ "b.cmo"; "project.cmo" ]

There clearly aren't any circular dependencies, are there? Am I missing
something?
The problem goes away if I export B instead of C. So the troublemaker seems
to be the include directive.

I almost forgot: I am using ocaml 3.10.2 from godi.

Johannes

--
Johannes Kanig
johanne...@lri.fr

Nicolas Pouillard

unread,
Sep 9, 2008, 9:53:04 AM9/9/08
to johannes.kanig, caml-list
Excerpts from johannes.kanig's message of Tue Sep 09 15:38:04 +0200 2008:

> Hi List,
>
> I have the following problem. I have three files, each consisting of one
> line:
>
> a.ml: type t = float
> b.ml: type t = A.t
> c.ml: include B
>
> Now I want to put these modules into a pack, but I only want to export A and
> C, so I write a file project.mli:
> module A : sig type t end
> module C : sig type t = A.t end
>
> As I want to use ocamlbuild, I also create a file project.mlpack:
> A
> C

B should be in the pack even if you want to hide it.

> Now, the command "ocamlbuild project.cmo" works fine, but I can't build a
> library from that:
> ocamlbuild project.cma
> Circular dependencies: "project.cmo" already seen in
> [ "b.cmo"; "project.cmo" ]
>
> There clearly aren't any circular dependencies, are there? Am I missing
> something?

B depends on A, but A is in the pack Project. {B|->Project}
Project includes C, that depends on B. {Project->B}

> The problem goes away if I export B instead of C. So the troublemaker seems
> to be the include directive.

In that case:

* A is in Project {}
* B depends on A that is in Project, but B is also in Project {}
* C depends on B that is in Project {C->Project}

No cycle in this one

--
Nicolas Pouillard aka Ertai

signature.asc

Johannes Kanig

unread,
Sep 9, 2008, 10:10:49 AM9/9/08
to Nicolas Pouillard, caml...@inria.fr
On Tue, Sep 9, 2008 at 3:51 PM, Nicolas Pouillard <
nicolas....@gmail.com> wrote:

> > As I want to use ocamlbuild, I also create a file project.mlpack:
> > A
> > C
>
> B should be in the pack even if you want to hide it.
>

Ok, that was the problem. Thanks!


--
Johannes Kanig
johanne...@lri.fr

0 new messages