Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#59389 - [xorg-server] Unable to build with debug symbols, please document

Attached to Project: Arch Linux
Opened by François Guerraz (kubrick) - Thursday, 19 July 2018, 09:45 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Thursday, 19 July 2018, 14:19 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


I'm trying to build xorg-server with debug instructions, but building with -O0 is problematic, even with -Wno-error, the build ends up crashing with

[675/793] Linking target hw/dmx/Xdmx.
FAILED: hw/dmx/Xdmx
ccache cc -o hw/dmx/Xdmx 'hw/dmx/hw@dmx@@Xdmx@exe/dmx.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxcb.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxcmap.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxcursor.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxdpms.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxextension.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxfont.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxgc.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxgcops.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxinit.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxinput.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxlog.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxpict.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxpixmap.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxprop.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxscrinit.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxstat.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxsync.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxvisual.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmxwindow.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/.._.._mi_miinitext.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/.._.._Xext_panoramiX.c.o' 'hw/dmx/hw@dmx@@Xdmx@exe/dmx_glxvisuals.c.o' -flto -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -fvisibility=hidden -march=native -mtune=native -O3 -pipe -fstack-protector-strong -g -fvar-tracking-assignments -fdebug-prefix-map=/tmp/xorg-server/src=/usr/src/debug -O0 -g3 -Wno-error -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--start-group dix/liblibxserver_main.a fb/liblibxserver_fb.a mi/liblibxserver_mi.a dix/liblibxserver_dix.a composite/liblibxserver_composite.a damageext/liblibxserver_damageext.a dbe/liblibxserver_dbe.a randr/liblibxserver_randr.a miext/damage/liblibxserver_miext_damage.a render/liblibxserver_render.a present/liblibxserver_present.a Xext/liblibxserver_xext.a miext/sync/liblibxserver_miext_sync.a xfixes/liblibxserver_xfixes.a Xi/liblibxserver_xi.a xkb/liblibxserver_xkb.a record/liblibxserver_record.a os/liblibxserver_os.a os/liblibxlibc.a dri3/liblibxserver_dri3.a xkb/liblibxserver_xkb_stubs.a hw/dmx/input/libdmx_input.a hw/dmx/config/libdmx_config.a hw/dmx/glxProxy/libdmx_glx.a /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ /usr/lib/ -ldl -lm /usr/lib/ -ldl /usr/lib/ /usr/lib/ /usr/lib/ -Wl,--end-group
/usr/bin/ld: Dwarf Error: Could not find abbrev number 59

I can't find any instructions on arch forums/wiki to build with debug, so I'm turning to you guys so you can help me and we can document it
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Thursday, 19 July 2018, 14:19 GMT
Reason for closing:  Not a bug
Comment by Jan de Groot (JGC) - Thursday, 19 July 2018, 11:35 GMT
Your linker failure is probably related to -flto in LDFLAGS.
Comment by Eli Schwartz (eschwartz) - Thursday, 19 July 2018, 12:35 GMT
There is nothing to document. makepkg.conf has an option to enable your chosen debugging CFLAGS, that's all. If it doesn't build, then there is going to be some highly specific per-package reason for it -- do you want us to have instructions for all our thousands of packages on how to fix something that is ultimately almost certainly an upstream bug?
Comment by François Guerraz (kubrick) - Thursday, 19 July 2018, 13:10 GMT
"If it doesn't build, then there is going to be some highly specific per-package reason for it": agreed.

Yet I have the possibly misguided expectation that if I set options=(debug), the PKGBUILD should be written in such a way that the "highly specific per-package" way of generating a debug package should be taken care of.
Otherwise, how are we (users who are not familiar with the intricacies of building each and every individual packages unlike maintainers are familiar with the packages they maintain) supposed to know? There is just no way because arch packages are very often build with custom, obscure to me and my google-fu, build options and tools.

So yes, I "want", or rather wish, that "all our thousands of packages" can be debugged.

I'm not asking for debug instructions for pleasure, but because I have a reproducible way of making Xwayland crash and need to produce a backtrace so that the bug can be reported properly. Everybody benefits. We don't have debug packages on arch. The ability to build with debug symbols seems like the bare minimum.
Comment by François Guerraz (kubrick) - Thursday, 19 July 2018, 14:13 GMT
Thanks @JGC, your suggestion is indeed correct.

Please find attached a patch that allows to compile a debug package with no headaches. I don't know if that's the right way of doing but it seems reasonable to me that PKGBUILDs should support options=(debug) and implement the necessary logic if they override the CFLAGS given by makepkg.