Original bug ID: 5593
Reporter: @alainfrisch
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2013-08-31T10:49:02Z)
Resolution: fixed
Priority: low
Severity: tweak
Category: ~DO NOT USE (was: OCaml general)
Bug description
Consider a file a.ml with a reference to Unix.
The following command line fails as expected:
$ ocamlc -output-obj -o a.c a.cmo
File "none", line 1, characters 0-1:
Error: Error while linking a.cmo:
Reference to undefined global `Unix'
But it leaves an incomplete file a.c. This is annoying because if one then fixes the command-line, the compiler refuses to overwrite this file:
$ ocamlc -output-obj -o a.c unix.cma a.cmo
File "none", line 1, characters 0-1:
Error: Cannot overwrite existing file a.c
I suggest to have "ocamlc -output-obj" removes its output in case of a linking error.