Skip to content

-output-obj leaves a C file in case of Reference to undefined global #5593

@vicuna

Description

@vicuna

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions