This Time Self-Hosted
dark mode light mode Search

XCB on *BSD: many pthread-related problems

I’m copying here a mail I just sent to the XCB mailing list with a few things I’ve just got by trying to find the cause of the xserver not starting on Prakesh:

So, I’ve been trying to find why X didn’t start after having it built fine
with xcb enabled… and I’ve seen there’s a little big mess with it on
FreeBSD (and DragonFly and OpenBSD at least, not sure on NetBSD, but it’s
likely to be the same).

Background: on *BSD systems there’s more than one library providing pthread
functions, the result is that the -pthread flag (as well as -lpthread) does
not link the threading libraries when producing a shared object, but only
when the final executable is generated, so that you don’t end up with two
different threading implementations in a single executable (that will result
in a crash); when linking a non-threaded program to a threaded library, you
need to pass -pthread to it to let it build correctly.

libX11 wasn’t threaded previously, but libxcb and libxcb-xlib are now. The
result is that programs linking to libX11 will now need to use -pthread to
finalise the link, or they won’t work. The patches I’ve sent today will fix
this problem for the packages using pkg-config to locate libX11 (mostly
modular-x packages right now, I suppose), but for everything else, a lot of
patching will be needed for xcb to be usable on FreeBSD (unless of course
Ports will try again to cut the edge and tinker with packages without fixing
the issue properly).

I’ll try to provide some quick ways to work around the issue, fixing the
packages I can find broken on my system, but I’d sure welcome some help 🙂 Or
even just an acknowldgement that I’m not doing this pointlessy.

This means, more things to fix… oh yes, most of KDE is fine already because Qt is threaded, so it “works around the issue”, but not everything, at least KControl and KDM needs to be slightly reworked.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.