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

GHC ghc-devs at haskell.org
Mon Nov 26 21:33:50 UTC 2018


#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


More information about the ghc-tickets mailing list