Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

vicuna opened this issue Apr 16, 2012 · 1 comment


None yet
2 participants
Copy link

commented Apr 16, 2012

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 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.


This comment has been minimized.

Copy link

commented Apr 16, 2012

Comment author: @alainfrisch

Fixed in trunk (commit 12356) and 4.00 (commit 12357).

@vicuna vicuna closed this Aug 31, 2013

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.