Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Build error in threads.c, maybe related to nptlonly use flag.
Date: Fri, 12 May 2006 18:10:49
Message-Id: 7573e9640605121047n1d575a48r5a9a81e683e86bfe@mail.gmail.com
In Reply to: [gentoo-user] Build error in threads.c, maybe related to nptlonly use flag. by Bob Young
1 On 5/12/06, Bob Young <BYoung@××××××××××.com> wrote:
2 > checking for pthread_mutexattr_setrobust_np... no
3 <snip>
4 > checking for pthread_mutexattr_setrobust_np in -lc... yes
5
6 > threads.c:145: error: `pthread_mutexattr_setrobust_np' undeclared (first use
7 > in this function)
8
9 > I think the "nptl nptlonly " use flags are relevant to this, but am not
10 > sure. I know the "kerberos" flag is related, but since the box will be
11 > interacting with an Active Directory domain controler kerberos seems
12 > appropiate to have.
13
14 Not an nptl issue, looks like a bug in the configure to me.
15
16 The configure is finding that glibc has the
17 pthread_mutexattr_setrobust_np function, so in threads.c it is
18 activating this piece of code:
19
20 # ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP_IN_THREAD_LIB
21 || &pthread_mutexattr_setrobust_np == 0
22 # endif
23
24 However, looking at /usr/include/pthread.h, we find this:
25
26 #ifdef __USE_GNU
27 /* Get the robustness flag of the mutex attribute ATTR. */
28 extern int pthread_mutexattr_getrobust_np (__const pthread_mutexattr_t *__attr,
29 int *__robustness) __THROW;
30
31 /* Set the robustness flag of the mutex attribute ATTR. */
32 extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
33 int __robustness) __THROW;
34 #endif
35
36 So these functions are GNU only, and a program is supposed to set the
37 define the __USE_GNU flag if it wants to use them.
38
39 This has already been reported to bugzilla, with patches:
40
41 http://bugs.gentoo.org/show_bug.cgi?id=125966
42
43 If you don't want to try and patch it yourself, try masking out this
44 version of mit-krb in /etc/portage/package.mask so you build the
45 previous one.
46
47 > Comment: Okay...It's available in "-lc" what does that mean?
48
49 That the function is available in glibc (GNU libc).
50
51 > and if it's available why is it causing a build error?
52
53 The program didn't see the prototype of the function, because it
54 didn't define __USE_GNU
55
56 > Comment: What does "-lc" mean?
57
58 Link against the 'c' library. The linker adds a 'lib' prefix and a
59 '.so' suffix to whatever is passed to the -l option, to come up with
60 libc.so.
61
62 Another example, -lqt means to link against libqt.so.
63
64 > Would declaring
65 > pthread_mutexattr_setrobust_np as "external" on the condition of some define
66 > solve the problem?
67
68 Actually, that _is_ the problem!!
69
70 > Again sorry for the long post,
71
72 No problem, you gave _plenty_ of information to figure out what was
73 wrong. Always a good thing!
74
75 -Richard
76
77 --
78 gentoo-user@g.o mailing list

Replies

Subject Author
RE: [gentoo-user] Build error in threads.c, maybe related to nptlonly use flag. Bob Young <BYoung@××××××××××.com>