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

Pass -g to ocamlc compiling C files when tagged with "debug" #6720

Closed
vicuna opened this issue Dec 17, 2014 · 10 comments
Closed

Pass -g to ocamlc compiling C files when tagged with "debug" #6720

vicuna opened this issue Dec 17, 2014 · 10 comments

Comments

@vicuna
Copy link

vicuna commented Dec 17, 2014

Original bug ID: 6720
Reporter: @whitequark
Status: acknowledged (set by @damiendoligez on 2017-03-01T13:32:54Z)
Resolution: reopened
Priority: normal
Severity: tweak
Category: compiler driver
Tags: patch
Monitored by: @whitequark

Bug description

E.g.:

flag ["c"; "compile"; "debug"] & A"-g";

File attachments

@vicuna
Copy link
Author

vicuna commented Dec 17, 2014

Comment author: @gasche

Implemented in trunk.

@vicuna
Copy link
Author

vicuna commented Dec 23, 2014

Comment author: @whitequark

This is actually not useful, because ocamlc -g does not pass -g through to the compiler.

@vicuna
Copy link
Author

vicuna commented Jan 6, 2015

Comment author: @whitequark

Attached a patch which fixes this.

@vicuna
Copy link
Author

vicuna commented Jan 24, 2015

Comment author: @gasche

Fixed in trunk.

@vicuna
Copy link
Author

vicuna commented Jan 24, 2015

Comment author: @whitequark

I think this needs to be backported to 4.02, as 6641 and 6720 was also backported.

@vicuna
Copy link
Author

vicuna commented Jan 24, 2015

Comment author: @gasche

I was uneasy about pushing this to the stable branch because it's not just a new feature but changes an existing behavior (that people may or may not rely). I just did it, though.

@vicuna
Copy link
Author

vicuna commented Feb 17, 2015

Comment author: @alainfrisch

The MSVC compiler doesn't recognize "-g". It doesn't fail on it, but simply report a warning:

cl : Command line warning D9002 : ignoring unknown option '-g'

I don't know if it is preferable to simply do nothing with MSVC ports, or rather to pass another debug-related option. I reopen the ticket so that we don't loose track of this.

(Note that -o also produces a warning:

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
)

@vicuna
Copy link
Author

vicuna commented Mar 1, 2017

Comment author: @damiendoligez

Note that this is not about ocamlbuild any more, but about the interaction between ocamlc/ocamlopt and the C compiler.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 11, 2020
@xavierleroy
Copy link
Contributor

The current situation is that -g is passed on to the C compiler, unless it is MSVC, in which case nothing is passed:

(if !Clflags.debug && Config.ccomp_type <> "msvc" then "-g" else "")

If someone cares about passing the right options to MSVC, go ahead and submit a pull request, it's a 1-line change. Meanwhile, I'll close this issue as pretty well addressed already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants