Re: ocamlopt and ocamldep

From: Xavier Leroy (
Date: Fri Sep 11 1998 - 19:09:56 MET DST

Date: Fri, 11 Sep 1998 19:09:56 +0200
From: Xavier Leroy <>
To: Christian Lindig <>,
Subject: Re: ocamlopt and ocamldep
In-Reply-To: <>; from Christian Lindig on Sat, Sep 05, 1998 at 02:33:27PM +0200

> The ocamldep utility in OCaml 2.0 creates for a file concept.mli that
> uses modules Bitrelation and Bitset a dependency of the following
> form:
> concept.cmi: bitrelation.cmo bitset.cmo

This is because bitrelation and bitset do not have an explicit
interface (.mli file). So, their interfaces actually depend on
their source file (.ml file), but "make" has a hard time understanding
this; the dependency on the .cmo above is what I've found to be
most understandable to "make".

> When compiling for native code this causes uncessessary recompilations
> of the files and
> and bitrelation are already compiled to *.cmx, *.cmi, and
> *.o. Because of the dependency generated by ocamldep they get
> recompiled using the *byte* code compiler and thus new *.cmi files are
> created as well.
> Should cmi-files depend on cmx-files when compiling for native code?

My feeling is that it would complicate the Makefiles for a fairly
small benefit. If you don't like the occasional calls to ocamlc, you
could write .mli files for all your modules (it's good style anyway).

> This does not matter in most cases since OCaml compiles very fast. I
> suspect the recompilation to cause subtle 'inconsistent assumptions
> over interface' errors in conjunction with -unsave -noassert compiler
> flags. However, I was not able to find a small example for this mail
> that reproduces the error.

If you can find one, please send it and I'll look at the problem.


- Xavier Leroy

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:15 MET