swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.21k stars 1.08k forks source link

Help troubleshoothing SIGSEGV on every invocation of Sway #8137

Closed LtdJorge closed 3 months ago

LtdJorge commented 3 months ago

Hi all,

I seem to have misconfigured my Gentoo system while troubleshooting non-compiling packages to the point where either Sway or one of its dependencies segfault every time I run Sway, so I can only do things from the basic Linux command line.

I've tried recompiling every dependency, Wlrooots' dependencies and glibc with -ggdb but I'm still missing debug symbols, it seems, so I cannot find where exactly the segmentation fault is ocurring.

I've extracted the partial backtrace thst GDB gives me:

in glDispatchCheckMultithreaded () at /usr/lib64/libGLdispatch.so.0

in eglQueryString () at /usr/lib64/libEGL.so.1

in ??? () at /usr/lib64/libwlroots.so.12

in wlr_egl_create_with_drm_fd () at /usr/lib64/libwlroots.so.12

in wlr_gles2_renderer_create_with_drm_fd () at /usr/lib64/libwlroots.so.12

in ??? () at /usr/lib64/libwlroots.so.12

 in ??? ()

 in ??? ()

in ??? ) at /usr/lib64/libc.so.6

in libc_start_main () at /usr/lib64/libc.so.6

in ??? ()

Since I don't have a GUI environment, I couldn't copy the text so I've had to do some Google lens magic. That's why it's missing the addresses.

Does anyone have any idea what is being called when the segfault happens?

Fyi: I have Clang with LTO setup as default compiler with some exceptions for packages that fail.

I have been running wlroots/sway under Clang/ThinLTO with mold as linker for months. Just recently I fucked around with enabling -fPIC globally and that seems to have broken libraries, so some packages have failed to compile and others are directly broken.

I've tried compiling sway with Clang/GCC, LTO/no LTO and mold/ld but the end result is always a segfault.

LtdJorge commented 3 months ago

sway.log

Here is my sway log. This is just running sway from the command line. The same happens when I run it from greetd with dbus-run-session sway —config /etc/greetd/sway-config

bl4ckb0ne commented 3 months ago

Sounds like an issue with your driver, have you recompiled mesa recently?

LtdJorge commented 3 months ago

I have finally reached a system where Sway doesn't crash. I've had to recompile like 6000 packages (~1600 installed) due to failures building too :(

I got glibc as a binary package first, then gcc and recompiled gcc with itself, and then rebuilt the entire dependency tree for Sway with around 10 packages being binary ones, and that seemed to do the trick.

As for your question, yes, many times. Mesa is particularly prone to failure while compiling after changing any CFLAG or LDFLAG. I think I'll leave CFLAGS vanilla for Mesa for a long time.

I'll have to be more careful with a subset of the packages, since mishandling them ends up being catastrophic. I'm also going to close the issue, since I cannot reproduce (or want to lol) anymore, and I never got to a Sway build with full debugging symbols. Thanks for your time and sorry for the inconvenience.