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

Add support for -g option #2702

Closed
bitonic opened this issue Jul 4, 2015 · 14 comments · Fixed by #6111
Closed

Add support for -g option #2702

bitonic opened this issue Jul 4, 2015 · 14 comments · Fixed by #6111

Comments

@bitonic
Copy link

bitonic commented Jul 4, 2015

-g builds libraries with DWARF symbols, but it's quite awkward to use it:

cabal install --disable-library-stripping --ghc-options="-g -rtsopts"

I think we should have a flag that automatically does the above.

Moreover, I'd also like a flag that stores the downloaded source, so that the debug symbols will refer to sources which still exist.

@cartazio
Copy link
Contributor

cartazio commented Jul 4, 2015

i think you can add that to your ~/.cabal/config file as a default ghc options flag

@23Skidoo
Copy link
Member

23Skidoo commented Jul 4, 2015

This seems to be already implemented (fbf8499). Try cabal install --disable-library-stripping --enable-debug-info.

/cc @tibbe

@bitonic
Copy link
Author

bitonic commented Jul 5, 2015

OK, I'd still like the second part to happen:

Moreover, I'd also like a flag that stores the downloaded source, so that the debug symbols will refer to sources which still exist.

It's extremely nice to get perf output side-by-side to the Haskell source.

@bitonic
Copy link
Author

bitonic commented Jul 6, 2015

Also, I'd say that --enable-debug-info should automatically disable library stripping, if that's not the case already.

@23Skidoo
Copy link
Member

23Skidoo commented Jul 6, 2015

Yes, makes sense.

@mpickering
Copy link
Collaborator

Just to point out that debug-info doesn't imply --disable-library-stripping still, which makes debug-info on its own rather useless. If someone points me to the right file then I will prepare a patch.

@lukel97
Copy link
Contributor

lukel97 commented Jun 24, 2019

@23Skidoo
Copy link
Member

23Skidoo commented Jun 25, 2019

@mpickering Good place to start is running rg stripLib and rg stripExe. We should also add a warning to cabal-install that fires when the user explicitly enables both one of library/executable-stripping: True and debug-info: True in the config file.

I think that normally one will want to either enable debug-info on per-project basis, or enable it system-wide just for libraries and use the default (strip exes) for exes cabal installed system-wide. So perhaps we need a separate library-debug-info option?

@mpickering
Copy link
Collaborator

@23Skidoo It seems the natural place to implement this is Cabal.Distribution.Simple.Configure.configure but by that point we have lost the knowledge about how the option came to be set. Where is the right place to implement warnings about things found in cabal.project files?

@mpickering
Copy link
Collaborator

defaultConfigFlags also seems to set the default to Flag True rather than NoFlag.

Unless there is a similar warning I can look at to see where to implement this check it seems like a lot of untangling to implement the logic where a warning happens if the user has explicitly set the option.

mpickering added a commit to mpickering/cabal that referenced this issue Jun 26, 2019
Fixes haskell#2702

If you enable `debug-info` then you also have to stop the libraries and
executables being stripped as otherwise the debug symbols are removed.
mpickering added a commit to mpickering/cabal that referenced this issue Jun 26, 2019
Fixes haskell#2702

If you enable `debug-info` then you also have to stop the libraries and
executables being stripped as otherwise the debug symbols are removed.
@mpickering
Copy link
Collaborator

Is this patch actually a good idea? It was only on v2-install that the executables were stripped. Now with this patch there's no way to strip executables when they are installed. Executables built with v2-build didn't get stripped.

@23Skidoo
Copy link
Member

23Skidoo commented Jul 1, 2019

Now with this patch there's no way to strip executables when they are installed.

You mean, if you have debug-info: True in .cabal/config?

@mpickering
Copy link
Collaborator

Yes if you set debug-info: 3 in a global setting.

@23Skidoo
Copy link
Member

23Skidoo commented Jul 2, 2019

Shouldn't this mean that installed exes should have debug info? Perhaps we can add a better warning (at .cabal/config load time).

23Skidoo pushed a commit to 23Skidoo/cabal that referenced this issue Aug 9, 2019
Fixes haskell#2702

If you enable `debug-info` then you also have to stop the libraries and
executables being stripped as otherwise the debug symbols are removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants