Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 491472 - =dev-libs/libpthread-stubs-0.3-r1: pthread_condattr_{init,destroy} hide libthr's ones
Summary: =dev-libs/libpthread-stubs-0.3-r1: pthread_condattr_{init,destroy} hide libth...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 425620
  Show dependency tree
 
Reported: 2013-11-17 09:32 UTC by Naohiro Aota
Modified: 2017-03-16 02:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposing patch (libpthread-stubs-0.3-freebsd.patch,776 bytes, patch)
2013-11-17 10:17 UTC, Naohiro Aota
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naohiro Aota gentoo-dev 2013-11-17 09:32:55 UTC
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.
Comment 2 Naohiro Aota gentoo-dev 2013-11-17 10:17:37 UTC
Created attachment 363392 [details, diff]
Proposing patch

This patch add LIBS="-lthr" on FreeBSD while detecting the functions.
Comment 3 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-11-17 21:03:36 UTC
Please open a bug report upstream at https://bugs.freedesktop.org/ too.
Comment 4 Naohiro Aota gentoo-dev 2013-11-27 16:33:52 UTC
(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
Comment 5 Matt Turner gentoo-dev 2017-03-16 02:01:10 UTC
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.