ocaml-obuild / obuild

simple package build system for ocaml
BSD 2-Clause "Simplified" License
55 stars 20 forks source link

missing a module recompile after a library change #4

Closed djs55 closed 11 years ago

djs55 commented 11 years ago

In djs55/ocaml-qmp I have:

lib/qmp,ml -- a library
lib_test/message.ml -- functions which test the library

I edited lib/qmp.ml and got:

djs@debian:~/djs55/ocaml-qmp$ obuild build
Building library qmp
[1 of 1] Compiling Qmp                               ( Source changed )
Linking library dist/build/lib-qmp/qmp.cmxa
Linking library dist/build/lib-qmp/qmp.cma
Building executable messages
Linking executable dist/build/messages/messages
File "_none_", line 1:
Error: Files dist/build/messages/messages.cmx and dist/build/lib-qmp/qmp.cmxa
       make inconsistent assumptions over interface Qmp

djs@debian:~/djs55/ocaml-qmp$ obuild build
Building library qmp
Linking library dist/build/lib-qmp/qmp.cmxa
Linking library dist/build/lib-qmp/qmp.cma
Building executable messages
Linking executable dist/build/messages/messages
File "_none_", line 1:
Error: Files dist/build/messages/messages.cmx and dist/build/lib-qmp/qmp.cmxa
       make inconsistent assumptions over interface Qmp

It looks like the client of the library needed to be recompiled when the library changed. I don't have an .mli yet (maybe this would have avoided the problem)

Here's some of the debug output:

building target exe-messages
Building executable messages
preparing compilation for exe-messages
Analysing Messages
  Messages has mtime 1359197609.000000
  [CMD]: /home/djs/.opam/4.00.1/bin/ocamldep.opt -I lib_test -I dist/build/autogen -modules lib_test/messages.ml
  Messages depends on Arg,Filename,List,OUnit,Printf,Qmp,String
  Messages internally depends on 
schedule finished: #processes=0 max_concurrency=0
  compilation order: Messages
  self deps: qmp
package deps: [easy-format,biniou,yojson,qmp,unix,oUnit]
Linking executable dist/build/messages/messages
  [CMD]: /home/djs/.opam/4.00.1/bin/ocamlopt.opt -o dist/build/messages/messages -I dist/build/messages -I /home/djs/.opam/4.00.1/lib/easy-format -I /home/djs/.opam/4.00.1/lib/biniou -I /home/d

js/.opam/4.00.1/lib/yojson -I dist/build/lib-qmp -I /home/djs/.opam/4.00.1/lib/ocaml -I /home/djs/.opam/4.00.1/lib/oUnit easy_format.cmx biniou.cmxa yojson.cmx qmp.cmxa unix.cmxa oUnit.cmxa -cc lib -Ldist/build/lib-qmp messages.cmx File "none", line 1: Error: Files dist/build/messages/messages.cmx and dist/build/lib-qmp/qmp.cmxa make inconsistent assumptions over interface Qmp

vincenthz commented 11 years ago

ah yes good catch. unfortunately i forgot this case, and internal libraries are under the same assumption as system libraries (i.e. they don't change, and if they do you need to re-configure your project). It's of course very wrong for internal libraries, I'll try to put a simple fix (invalidating all the .cmx, .cmo if internal libs changes, forcing the recompilation of the target that use it). Later on, I'll fix it properly so that only the module that depends on the lib (either directly or indirectly) will be recompiled.

vincenthz commented 11 years ago

as a quick workaround, you can either obuild configure et do a full rebuild, or do a rm dist/build/messages/*.{cmx,cmo,cmi}

djs55 commented 11 years ago

The full rebuild workaround is fine for me -- there's so little code in the tree so far it takes no time at all! :-)

On Sat, Jan 26, 2013 at 1:12 PM, Vincent Hanquez notifications@github.comwrote:

as a quick workaround, you can either obuild configure et do a full rebuild, or do a rm dist/build/messages/*.{cmx,cmo,cmi}

— Reply to this email directly or view it on GitHubhttps://github.com/vincenthz/obuild/issues/4#issuecomment-12735155.

Dave Scott