[GHC] #15955: Cannot get debugging symbols for compiled c-sources

#15955: Cannot get debugging symbols for compiled c-sources -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I cannot for my life figure out how to pass `-g` to some cabal-file `c-sources`'s compilation. I've tried putting various combinations into `ghc-options`, but for the cases where compilation runs through, debugging symbols are not present, and for all other cases the assembler crashes, with the message as shown in my little survey of flags and whether they end up at `as` (as determined via `strace`): {{{ Using ghc-8.2.2 -g -optc-g -opta-g -optc-Wa,-g -opta-Wa,-g passes -g to as -g -optc-g -opta-g -optc-Wa,-g does not pass -g to as -g -optc-g -opta-g -opta-Wa,-g passes -g to as -optc-g -opta-g -opta-Wa,-g does not pass -g to as -g -opta-g -opta-Wa,-g passes --gdwarf2 and -g to as -g -opta-Wa,-g passes -g to as (and no --gdwarf2) -g -opta-g passes --gdwarf2 to as, but no -g However, in all 3 cases above the build fails with /tmp/ghc6595_0/ghc_4.s:444:0: error: Error: file number 1 already allocated | 444 | .file 1 "src/Codec/Compression/LZ4/Conduit.hsc" | ^ `gcc' failed in phase `Assembler'. (Exit code: 1) }}} (copied from https://gist.github.com/nh2/b57ed4c419f7b13d7cc299caa335f3ab) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15955 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15955: Cannot get debugging symbols for compiled c-sources -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by nh2: Old description:
I cannot for my life figure out how to pass `-g` to some cabal-file `c-sources`'s compilation.
I've tried putting various combinations into `ghc-options`, but for the cases where compilation runs through, debugging symbols are not present, and for all other cases the assembler crashes, with the message as shown in my little survey of flags and whether they end up at `as` (as determined via `strace`):
{{{ Using ghc-8.2.2
-g -optc-g -opta-g -optc-Wa,-g -opta-Wa,-g passes -g to as
-g -optc-g -opta-g -optc-Wa,-g does not pass -g to as
-g -optc-g -opta-g -opta-Wa,-g passes -g to as
-optc-g -opta-g -opta-Wa,-g does not pass -g to as
-g -opta-g -opta-Wa,-g passes --gdwarf2 and -g to as
-g -opta-Wa,-g passes -g to as (and no --gdwarf2)
-g -opta-g passes --gdwarf2 to as, but no -g
However, in all 3 cases above the build fails with
/tmp/ghc6595_0/ghc_4.s:444:0: error: Error: file number 1 already allocated | 444 | .file 1 "src/Codec/Compression/LZ4/Conduit.hsc" | ^ `gcc' failed in phase `Assembler'. (Exit code: 1) }}}
(copied from https://gist.github.com/nh2/b57ed4c419f7b13d7cc299caa335f3ab)
New description: I cannot for my life figure out how to pass `-g` to some cabal-file `c-sources`'s compilation. I've tried putting various combinations into `ghc-options`, but for the cases where compilation runs through, debugging symbols are not present, and for all other cases the assembler crashes, with the message as shown in my little survey of flags and whether they end up at `as` (as determined via `strace`): {{{ Using ghc-8.2.2 -g -optc-g -opta-g -optc-Wa,-g -opta-Wa,-g passes -g to as -g -optc-g -opta-g -optc-Wa,-g does not pass -g to as -g -optc-g -opta-g -opta-Wa,-g passes -g to as -optc-g -opta-g -opta-Wa,-g does not pass -g to as -g -opta-g -opta-Wa,-g passes --gdwarf2 and -g to as -g -opta-Wa,-g passes -g to as (and no --gdwarf2) -g -opta-g passes --gdwarf2 to as, but no -g However, in all the last 3 cases above where some form of -g is passed, the build fails with /tmp/ghc6595_0/ghc_4.s:444:0: error: Error: file number 1 already allocated | 444 | .file 1 "src/Codec/Compression/LZ4/Conduit.hsc" | ^ `gcc' failed in phase `Assembler'. (Exit code: 1) }}} (copied from https://gist.github.com/nh2/b57ed4c419f7b13d7cc299caa335f3ab) -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15955#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15955: Cannot get debugging symbols for compiled c-sources -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Contents of the file it complains about (`ghc_4.s` equivalent from another run): https://gist.github.com/nh2/b57ed4c419f7b13d7cc299caa335f3ab/raw/704d054726b... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15955#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15955: Cannot get debugging symbols for compiled c-sources -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Thanks to bgamari and slyfox on IRC, I found that all that matters is that the symbols are in the generated `.s` assembly file. When that is the case, it isn't necessary to pass `-g` to `as`. And it turned out the issue is somewhere completely different. https://github.com/haskell/cabal/commit/81017f44 Looks like Cabal strips the executable at install time; if I had run the executable in `dist/`, it wouldn't have, and indeed that one has my symbols. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15955#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15955: Cannot get debugging symbols for compiled c-sources -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nh2): * status: new => closed * resolution: => invalid -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15955#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC