On 5/12/06, Bob Young <[EMAIL PROTECTED]> wrote:
checking for pthread_mutexattr_setrobust_np... no
<snip>
checking for pthread_mutexattr_setrobust_np in -lc... yes

threads.c:145: error: `pthread_mutexattr_setrobust_np' undeclared (first use
in this function)

I think the "nptl nptlonly " use flags are relevant to this, but am not
sure. I know the "kerberos" flag is related, but since the box will be
interacting with an Active Directory domain controler kerberos seems
appropiate to have.

Not an nptl issue, looks like a bug in the configure to me.

The configure is finding that glibc has the
pthread_mutexattr_setrobust_np function, so in threads.c it is
activating this piece of code:

# ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP_IN_THREAD_LIB
       || &pthread_mutexattr_setrobust_np == 0
# endif

However, looking at /usr/include/pthread.h, we find this:

#ifdef __USE_GNU
/* Get the robustness flag of the mutex attribute ATTR.  */
extern int pthread_mutexattr_getrobust_np (__const pthread_mutexattr_t *__attr,
                                          int *__robustness) __THROW;

/* Set the robustness flag of the mutex attribute ATTR.  */
extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
                                          int __robustness) __THROW;
#endif

So these functions are GNU only, and a program is supposed to set the
define the __USE_GNU flag if it wants to use them.

This has already been reported to bugzilla, with patches:

http://bugs.gentoo.org/show_bug.cgi?id=125966

If you don't want to try and patch it yourself, try masking out this
version of mit-krb in /etc/portage/package.mask so you build the
previous one.

Comment: Okay...It's available in "-lc" what does that mean?

That the function is available in glibc (GNU libc).

and if it's available why is it causing a build error?

The program didn't see the prototype of the function, because it
didn't define __USE_GNU

Comment: What does "-lc" mean?

Link against the 'c' library.  The linker adds a 'lib' prefix and a
'.so' suffix to whatever is passed to the -l option, to come up with
libc.so.

Another example, -lqt means to link against libqt.so.

Would declaring
pthread_mutexattr_setrobust_np as "external" on the condition of some define
solve the problem?

Actually, that _is_ the problem!!

Again sorry for the long post,

No problem, you gave _plenty_ of information to figure out what was
wrong.  Always a good thing!

-Richard

--
gentoo-user@gentoo.org mailing list

Reply via email to