From f1ecf669d82c8b6d05068e12f96f993982ecb533 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Mon, 16 Jun 2014 10:03:29 +0200 Subject: Preemptively remove files from native compilation. Ocaml does not remove the .cmi file if compilation fails, thus causing subsequent native compilations to fail due to mismatching interfaces. For the sake of homogeneity, also remove the .cmo/.cmxs file along the way. --- kernel/nativelib.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kernel/nativelib.ml') diff --git a/kernel/nativelib.ml b/kernel/nativelib.ml index b877dda8f1..0ad3457952 100644 --- a/kernel/nativelib.ml +++ b/kernel/nativelib.ml @@ -67,6 +67,9 @@ let call_compiler ml_filename = let f = Filename.chop_extension ml_filename in let link_filename = f ^ ".cmo" in let link_filename = Dynlink.adapt_filename link_filename in + let remove f = if Sys.file_exists f then Sys.remove f in + remove link_filename; + remove (f ^ ".cmi"); let comp_cmd = Format.sprintf "%s -%s -o %s -rectypes -w a -I %s -impl %s" compiler_name (if Dynlink.is_native then "shared" else "c") -- cgit v1.2.3