caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlopt and ocamldep
@ 1998-09-05 12:33 Christian Lindig
  1998-09-11 17:09 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lindig @ 1998-09-05 12:33 UTC (permalink / raw)
  To: Caml Mailing List


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

When compiling for native code this causes uncessessary recompilations 
of the files bitrelation.ml and bitset.ml:

        % make colibri.cmxa 
        ocamlopt.opt -I ../libcolibri -I ../getopt   -c stat.mli
        ocamlopt.opt -I ../libcolibri -I ../getopt -c stat.ml
   -->  ocamlopt.opt -I ../libcolibri -I ../getopt -c bitset.ml
   -->  ocamlopt.opt -I ../libcolibri -I ../getopt -c bitrelation.ml
        ocamlopt.opt -I ../libcolibri -I ../getopt   -c intcode.mli
        ocamlopt.opt -I ../libcolibri -I ../getopt -c intcode.ml
   ==>  ocamlc -I ../libcolibri -I ../getopt   -c bitset.ml
   ==>  ocamlc -I ../libcolibri -I ../getopt   -c bitrelation.ml
   -->  ocamlopt.opt -I ../libcolibri -I ../getopt   -c concept.mli
        ocamlopt.opt -I ../libcolibri -I ../getopt -c concept.ml
        ocamlopt.opt -I ../libcolibri -I ../getopt   -c lattice.mli
        ocamlopt.opt -I ../libcolibri -I ../getopt -c lattice.ml
        ocamlopt.opt -I ../libcolibri -I ../getopt -c context.ml
        ocamlopt.opt -I ../libcolibri -I ../getopt -a -o colibri.cmxa 
            stat.cmx bitset.cmx bitrelation.cmx intcode.cmx concept.cmx 
            lattice.cmx context.cmx
      
bitset.ml 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.

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.

Should cmi-files depend on cmx-files when compiling for native code?
This would avoid uneccessary recompilations but would also make
integrating byte code compilation and native code compilation into one
Makefile much harder.

-- Christian

------------------------------------------------------------------------------
Christian Lindig                  http://www.cs.tu-bs.de/softech/people/lindig 
                                  mail:  lindig@ips.cs.tu-bs.de  






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ocamlopt and ocamldep
  1998-09-05 12:33 ocamlopt and ocamldep Christian Lindig
@ 1998-09-11 17:09 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1998-09-11 17:09 UTC (permalink / raw)
  To: Christian Lindig, Caml Mailing List

> 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 bitrelation.ml and bitset.ml:
> bitset.ml 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.

Regards,

- Xavier Leroy





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-09-11 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-05 12:33 ocamlopt and ocamldep Christian Lindig
1998-09-11 17:09 ` Xavier Leroy

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).