Cannot get debugging symbols for compiled c-sources
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)