caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@pps.jussieu.fr>
To: caml-list@yquem.inria.fr
Subject: Circular dependencies
Date: Mon, 6 Jul 2009 11:27:04 +0200	[thread overview]
Message-ID: <20090706092704.GA20957@uranium.pps.jussieu.fr> (raw)

Hi all,
I've this small compilation problem with ocamlbuild. Basically
private.ml contains the common part of pub1.ml and pub2.ml and out.ml
contains the output type. Here I'm trying to hide private.ml and to 
provide a module algo with only the public interface. If there is a
better way of doing this, I'll be happy to learn. I don't quite get the
circular dependency problem ...

thanks for your help !

Briefly:

#ls
_tags  algo.mlpack  out.ml  private.ml  pub1.ml  pub2.ml

#cat _tags 
<{pub1,pub2,out}.cmx>: for-pack(Algo)

#cat algo.mlpack 
Pub1
Pub2
Out

#cat out.ml      
let b = ()

#cat pub1.ml 
let b = Private.a

#cat pub2.ml 
let b = Private.a

#cat private.ml 
let a = Out.b ;;

Then when I try to compile my library I get : 

#ocamlbuild -classic-display algo.cma
/usr/bin/ocamldep -modules pub1.ml > pub1.ml.depends
/usr/bin/ocamldep -modules private.ml > private.ml.depends
/usr/bin/ocamldep -modules out.ml > out.ml.depends
/usr/bin/ocamlc -c -o out.cmo out.ml
/usr/bin/ocamlc -c -o private.cmo private.ml
/usr/bin/ocamldep -modules pub2.ml > pub2.ml.depends
/usr/bin/ocamlc -c -o pub1.cmo pub1.ml
/usr/bin/ocamlc -c -o pub2.cmo pub2.ml
/usr/bin/ocamlc -pack out.cmo pub1.cmo pub2.cmo -o algo.cmo
Circular dependencies: "algo.cmo" already seen in
  [ "private.cmo"; "algo.cmo" ]
  
as native library :

#ocamlbuild -classic-display algo.cmxa
/usr/bin/ocamlopt -c -for-pack Algo -o out.cmx out.ml
/usr/bin/ocamlopt -c -o private.cmx private.ml
/usr/bin/ocamlopt -c -for-pack Algo -o pub1.cmx pub1.ml
/usr/bin/ocamlopt -c -for-pack Algo -o pub2.cmx pub2.ml
touch algo.mli  ; if  /usr/bin/ocamlopt -pack out.cmx pub1.cmx pub2.cmx
-o algo.cmx  ; then  rm -f algo.mli  ; else  rm -f algo.mli  ; exit 1;
fi
Circular dependencies: "algo.cmx" already seen in
  [ "private.cmx"; "algo.cmx" ]
  

-- 
----
http://en.wikipedia.org/wiki/Posting_style


             reply	other threads:[~2009-07-06  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06  9:27 Pietro Abate [this message]
2009-07-06 10:25 ` [Caml-list] " Johannes Kanig
2009-07-06 10:56   ` Pietro Abate
2009-07-06 11:19     ` Johannes Kanig

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=20090706092704.GA20957@uranium.pps.jussieu.fr \
    --to=pietro.abate@pps.jussieu.fr \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).