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

Closed
vicuna opened this issue Apr 16, 2012 · 1 comment
Closed

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

vicuna opened this issue Apr 16, 2012 · 1 comment
Assignees
Labels

Comments

@vicuna
Copy link

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

@vicuna
Copy link
Author

vicuna commented Apr 16, 2012

Comment author: @alainfrisch

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

@vicuna vicuna closed this as completed Aug 31, 2013
@vicuna vicuna added the bug label Mar 20, 2019
dra27 pushed a commit to dra27/ocaml that referenced this issue Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants