[krbdev.mit.edu #3358] krb5 doesn't build when pthread_mutexattr_setrobust_np is defined but not declared

The RT System itself via RT rt-comment at krbdev.mit.edu
Thu Jan 19 19:36:55 EST 2006


>From krb5-bugs-incoming-bounces at PCH.mit.edu  Thu Jan 19 19:36:47 2006
Received: from pch.mit.edu (PCH.MIT.EDU [18.7.21.90]) by krbdev.mit.edu (8.9.3p2) with ESMTP
	id TAA25039; Thu, 19 Jan 2006 19:36:46 -0500 (EST)
Received: from pch.mit.edu (pch.mit.edu [127.0.0.1])
	by pch.mit.edu (8.12.8p2/8.12.8) with ESMTP id k0K0aHei016278
	for <krb5-send-pr at krbdev.mit.edu>; Thu, 19 Jan 2006 19:36:17 -0500
Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU
	[18.7.7.76])
	by pch.mit.edu (8.12.8p2/8.12.8) with ESMTP id k0K0GSei013550
	for <krb5-bugs-incoming at PCH.mit.edu>; Thu, 19 Jan 2006 19:16:28 -0500
Received: from rapier.boston.redhat.com (nat-pool-bos.redhat.com
	[66.187.230.200])
	by fort-point-station.mit.edu (8.12.4/8.9.2) with ESMTP id
	k0K0GL2W008955
	for <krb5-bugs at mit.edu>; Thu, 19 Jan 2006 19:16:21 -0500 (EST)
Received: from rapier.boston.redhat.com (localhost.localdomain [127.0.0.1])
	by rapier.boston.redhat.com (8.13.5/8.13.5) with ESMTP id
	k0K0GKFn030517
	for <krb5-bugs at mit.edu>; Thu, 19 Jan 2006 19:16:20 -0500
Received: (from nalin at localhost)
	by rapier.boston.redhat.com (8.13.5/8.13.5/Submit) id k0K0GKtj030516;
	Thu, 19 Jan 2006 19:16:20 -0500
Date: Thu, 19 Jan 2006 19:16:20 -0500
Message-Id: <200601200016.k0K0GKtj030516 at rapier.boston.redhat.com>
To: krb5-bugs at mit.edu
Subject: build failure when pthread_mutexattr_setrobust_np is defined but not
	declared
From: nalin at redhat.com
X-send-pr-version: 3.99
X-Spam-Score: -1.638
X-Spam-Flag: NO
X-Scanned-By: MIMEDefang 2.42
X-Mailman-Approved-At: Thu, 19 Jan 2006 19:36:16 -0500
X-BeenThere: krb5-bugs-incoming at mailman.mit.edu
X-Mailman-Version: 2.1.6
Precedence: list
Sender: krb5-bugs-incoming-bounces at PCH.mit.edu
Errors-To: krb5-bugs-incoming-bounces at PCH.mit.edu


>Submitter-Id:	net
>Originator:	Nalin Dahyabhai
>Organization:
>Confidential:	no
>Synopsis:	krb5 doesn't build when pthread_mutexattr_setrobust_np is defined but not declared
>Severity:	non-critical
>Priority:	medium
>Category:	krb5-build
>Class:		sw-bug
>Release:	1.4.3
>Environment:
	
System: Linux rapier.boston.redhat.com 2.6.15-1.1826.2.10_FC5 #1 Wed Jan 11 18:12:42 EST 2006 i686 i686 i386 GNU/Linux
Architecture: i686

>Description:
	Attempts to build the 1.4.3 release with a recent glibc snapshot (mine
	identifies itself as 2.3.90, for what that's worth) fail because while
	libpthread provides the pthread_mutexattr_setrobust_np symbol, the
	header only declares it if _GNU_SOURCE is defined.  This is not the
	default for Kerberos 5, but the configure script detects the symbol and
	defines HAVE_PTHREAD_MUTEXATTR_SETROBUST_MP, causing a compile failure
	when src/util/support/threads.c attempts to use take the address of the
	function.
>How-To-Repeat:
	Attempt to build against the same version of glibc (or Fedora Core,
	development version), or after temporarily removing the declaration of
	the function from a system which provides it from whichever header
	declares it.
>Fix:
	Checking if the function is both declared and defined seems to be the
	dependable way to handle it.  A patch:

--- krb5-1.4.3/src/aclocal.m4	2006-01-19 18:56:17.000000000 -0500
+++ krb5-1.4.3/src/aclocal.m4	2006-01-19 18:56:11.000000000 -0500
@@ -171,7 +171,14 @@
 dnl reference support we can figure out whether or not the pthread library
 dnl has been linked in.
 dnl If we don't add any libraries for thread support, don't bother.
-AC_CHECK_FUNCS(pthread_once pthread_mutexattr_setrobust_np pthread_rwlock_init)
+for fn in pthread_once pthread_mutexattr_setrobust_np pthread_rwlock_init ; do
+	AC_CHECK_DECLS($fn,,,[
+	#ifdef HAVE_PTHREAD
+	#include <pthread.h>
+	#endif
+	])
+	AC_CHECK_FUNCS($fn)
+done
 old_CC="$CC"
 test "$PTHREAD_CC" != "" && test "$ac_cv_c_compiler_gnu" = no && CC=$PTHREAD_CC
 old_CFLAGS="$CFLAGS"
--- krb5-1.4.3/src/util/support/threads.c	2005-08-12 16:57:07.000000000 -0400
+++ krb5-1.4.3/src/util/support/threads.c	2006-01-19 19:00:59.000000000 -0500
@@ -141,7 +141,7 @@
 	|| &pthread_equal == 0
 	/* This catches Solaris 9.  May be redundant with the above
 	   tests now.  */
-# ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP_IN_THREAD_LIB
+# if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP_IN_THREAD_LIB) && HAVE_DECL_PTHREAD_MUTEXATTR_SETROBUST_NP
 	|| &pthread_mutexattr_setrobust_np == 0
 # endif
 	/* Any program that's really multithreaded will have to be




More information about the krb5-bugs mailing list