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
ocamlopt and ocamldep
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1998-09-06 (17:59)
From: Christian Lindig <lindig@i...>
Subject: ocamlopt and ocamldep

The ocamldep utility in OCaml 2.0 creates for a file concept.mli that
uses modules Bitrelation and Bitset a dependency of the following

        concept.cmi: bitrelation.cmo bitset.cmo

When compiling for native code this causes uncessessary recompilations 
of the files and

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