| Summary: | =dev-libs/libpthread-stubs-0.3-r1: pthread_condattr_{init,destroy} hide libthr's ones | ||
|---|---|---|---|
| Product: | Gentoo/Alt | Reporter: | Naohiro Aota <naota> |
| Component: | FreeBSD | Assignee: | Gentoo/BSD Team <bsd+disabled> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | x11 |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | FreeBSD | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Bug Depends on: | |||
| Bug Blocks: | 425620 | ||
| Attachments: | Proposing patch | ||
Also refer FreeBSD ports' patch: http://svnweb.freebsd.org/ports/head/devel/libpthread-stubs/files/patch-stubs.c?revision=300896&view=markup Created attachment 363392 [details, diff]
Proposing patch
This patch add LIBS="-lthr" on FreeBSD while detecting the functions.
Please open a bug report upstream at https://bugs.freedesktop.org/ too. (In reply to Chí-Thanh Christopher Nguyễn from comment #3) > Please open a bug report upstream at https://bugs.freedesktop.org/ too. Reported upstream. https://bugs.freedesktop.org/show_bug.cgi?id=72074 I mailed xcb and freebsd. No one from freebsd responded. https://lists.freedesktop.org/archives/xcb/2017-March/010953.html pthread-stubs-0.4 is now released, and its release announcement states | pthread-stubs 0.4 is now available. This new release stops providing | stubs, but instead expects libc to do so. On platforms where this is | not the case, "-pthread" is injected via our pkg-config file instead. | This was done to make loading libpthread (indirectly) via dlopen() | work correctly in the presence of pthread-stubs. So I think this should be solved. |
pthread_condattr_{init,destroy} is available in libthr.so: # readelf -s /lib/libthr.so.3 |grep condattr_init 112: 00007990 68 FUNC WEAK DEFAULT 12 pthread_condattr_init@@FBSD_1.0 262: 00007990 68 FUNC GLOBAL DEFAULT 12 _pthread_condattr_init@@FBSDprivate_1.0 It also appear in libpthread-stubs.so: # readelf -s /usr/lib/libpthread-stubs.so |grep condattr_init 5: 00000420 3 FUNC WEAK DEFAULT 11 pthread_condattr_init These mis-added symbols cause an actual failure. (e.g. bug #425620) g-ir-scanner generate a program linked to libpthread-stubs: # ldd tmp-introspectJH2et5/.libs/Pango-1.0 |grep thr libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x28071000) libpthread-stubs.so.0 => /usr/lib/libpthread-stubs.so.0 (0x285d3000) libthr.so.3 => /lib/libthr.so.3 (0x288b6000) The lines below is from glib-2.36.4/glib/gthread-posix.c. Since the program is linked to libpthread-stubs, "pthread_condattr_init" call one from libpthred-stubs which dose nothing. Then pthread_condattr_setclock call one from libthr, which assume that "attr" is properly initialized by pthread_condattr_init from libthr. 640 pthread_condattr_init (&attr); 641 #if defined (HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined (CLOCK_MONOTONIC) 642 pthread_condattr_setclock (&attr, CLOCK_MONOTONIC); 643 #endif We should drop pthread_condattr_{init,destroy} from libpthread-stubs.