Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-26 (08:43)
From: Nicolas Pouillard <nicolas.pouillard@i...>
Subject: Re: [Caml-list] ocamlbuild
Excerpts from skaller's message of Tue Sep 25 16:19:44 +0200 2007:
> On Tue, 2007-09-25 at 13:45 +0200, Nicolas Pouillard wrote:
> > Excerpts from skaller's message of Mon Sep 17 18:21:34 +0200 2007:
> > Have you try this, since this part can be very time consuming.
> Since the problem went away when I deleted the whole directory
> and recreated it, I can't debug the problem now, sorry ;(
> > > So just keep an eye out for someone having a similar problem.
> > 
> > Is you source tree very big?
> No, not particularly: 10 subdirectories, the biggest contains
> 95 *.ml files and similar number of *.mli files, others
> probably 5-10 files each.
> > > Erick reports another issue: ocamlbuild tries to rebuild 
> > > libraries a code depends on -- but not the system libraries.
> > 
> > Yes it even don't know that's system libraries.
> Sorry, I can't parse that. Ocamlbuild doesn't try to build system
> libraries .. how does it know what libraries are system libraries
> which are not to be rebuilt, and which one are application 
> libraries which require rebuilding?

There is an exception for stdlib.cma, otherwise it's rebuilt if needed.

Note  also  that  ocamlbuild  behave  differently  than  make, since when make
encounter  the  target file, it tries to build it with other rules if there is
no  such  rule it keeps the file. However when ocamlbuild encounter the target
file  (in  the source dir) it stops here. This approach works because there is
a  separation  between  the  source dir and the build dir. So in conclusion if
ocamlbuild  found  a .cmo that is needed in the source dir (tagged precious to
avoid the sanitize step) it will use it.

> > > The idea of building a library is to *avoid* having to do
> > > any dependency checking on the module level. Is there some
> > > way to fix this? I.e, to 'make' a library, and then have
> > > it treated as a 'system' library.
> > 
> > Yes you can do it by showing it the directory with compiled files.
> > Then you have to explain it that all these .cmo,.cmi... are not junk files.
> They are though, and indeed the *.ml and *.mli files are also junk.
> We just want the *.cm(x)a library to be used, not rebuilt.
> To explain better: we go to directory liba, and we use Ocamlbuild
> to build 
>     liba.cmxa
> Ok, now we go to directory prog, which needs modules from liba,
> and we tell it to build
>     prog
> In this second step, ocamlbuild is not allowed to check if the
> library is up to date. It just uses the binary library, without
> examining any source code.
> Because, we already used Ocamlbuild to build it, and it is
> expensive to rescan all the source code for liba, and even
> if it is found to be out of date, Ocamlbuild's current invocation
> cannot rebuild it. It could be installed in read-only location
> for example.
> So even though ocamldep will say prog depends on modules from
> liba, we don't care. They're excluded from consideration.

To do so, in prog you can type...

$ ln -s /path/to/liba/_build liba
$ echo '"liba": include, precious' >> _tags

Nicolas Pouillard aka Ertai