[Omake] race condition in omake?

Nicholas Kidd kidd at cs.wisc.edu
Thu Dec 21 08:32:08 PST 2006


Hi,

Using omake, the following command sometimes fails and sometimes succeeds:

omake clean main

Basically, sometimes the file "main.cmi" is not built and compilation fails.

Let me first state that I am relatively new to both ocaml and omake. So, 
this may not be a bug, but my misunderstanding of how omake works when 
multiple targets are supplied on the command line. Does omake attempt to 
run them in parallel? If so, that would explain the problem.  I've 
included the files below.


Thanks,
-Nick
--------------------------------------------------------------------------

<-- main.mli -->
module A :
sig
   type t = { f1 : int ; f2 : string }
end

val main : unit -> unit


<-- main.ml -->
module A =
struct
   type t = { f1 : int ; f2 : string }
end

let main () =
   let x = { A.f1 = 0 ; A.f2 = "string" } in
     Printf.printf "%d and %S\n" x.A.f1 x.A.f2

Here is the OMakefile:
USE_OCAMLFIND = true

FILES[] = main
PROGRAM = main
.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES))

.PHONY: clean
clean:
    rm -f \
	$(filter-proper-targets $(glob $(addsuffix .*, $(FILES)))) \
         $(PROGRAM)$(EXE)

Here is the output from two runs:

<-- Run 1 -->

[~] $ omake clean main
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.0 sec)
*** omake: done (0.8 sec, 0/2 scans, 5/6 rules, 5/93 digests)

<-- Run 2 -->

[~] $ omake clean main
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.0 sec)
- build . main.o
+ ocamlfind ocamlopt -warn-error A -I . -c main.ml
File "main.ml", line 1, characters 0-1:
Could not find the .cmi file for interface main.mli.
*** omake: 17/23 targets are up to date
*** omake: failed (0.2 sec, 0/2 scans, 2/3 rules, 0/86 digests)
*** omake: targets were not rebuilt because of errors:
    main.o
       depends on: main.ml
    main.cmx
       depends on: main.ml





More information about the Omake mailing list