Background: On OpenBSD, and on old FreeBSD, libc lacks pthread stubs. This is a problem because libX11 needs to support threading, but shouldn't cause all X programs to be linked against the threading library. The solution is libXThrStub (UIThrStubs.c), which provides weak symbols to stub threading functions, which are ignored if the application links against the thread library. However, it seems silly to me to have this as a separate library. There are two consumers of it: libX11 and libGL. Anyone linking against libGL is linking against libX11 anyway. Moving the UIThrStubs.c code into libX11 removes some os-specific mess in config/cf/ and removes a library from the system that's not used by anyone but libX11. Attached is a patch for review that does the UIThrStubs.c move (which I would do with a repocopy, if approved) and cleans up/fixes some threading imake defines on BSDs. Any feedback on this?
Created attachment 299 [details] [review] move of UIThrStubs.c to X11 and fixing of some thread defines
BTW, this is what is already done in OpenBSD's XF4's tree, for the same reason that Eric mentions. I don't remember why I never tried to commit it back to XFree86 though.
Committed a fixed-up variation of this patch.
This change broke threading on FreeBSD 4.x, and we've noticed it widely with glib threads apps as of the 6.8.1 update. The issue is (afaik) that our libc_r pthread symbols are weak (why? I don't know.), so having the weak stubs in libX11 causes the weak stubs to be selected instead of the real ones in libc_r, while having them in a separate library pulled in by libX11 works. I think the change needs to be backed out.
Are the changes currently backed out or is this not an issue anymore?
Ping!
With the libpthread-stubs in libxcb, I'm happy that this bug is done with now.
Is this bug really fixed? I didn't remove the thread stubs from libX11, even though when linked with libxcb it'll pull libpthread-stubs in too. Somebody who can test on a system that needs thread stubs probably should do that. In particular, I haven't checked that libpthread-stubs has a superset of the stubs provided by libX11 or libGL. If libpthread-stubs is missing any, a patch would be appreciated.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.