[gentoo-user] Build error in threads.c, maybe related to nptlonly use flag.

2006-05-12 Thread Bob Young

Hi all,

In advance please pardon the long post.

I'm trying to do a  stage 1/3 install as described here:
http://forums.gentoo.org/viewtopic-t-345229.html

I've successfully rebuilt the tool chain and am at the stage of rebuilding
the system with the new toolchain. Unfortunately I've encountered a build
error with krb5-1.4.3 that I don't know how to solve. The following is what
I believe to be the relevent output from #emerge -e system



>>> Unpacking source...
>>> Unpacking krb5-1.4.3-signed.tar to /var/tmp/portage/mit-krb5-1.4.3/work
 Applying mit-krb5-lazyldflags.patch ...
>>> Source unpacked.
 * econf: updating krb5-1.4.3/src/config/config.guess with
/usr/share/gnuconfig/config.guess
 * econf: updating krb5-1.4.3/src/config/config.sub with
/usr/share/gnuconfig/config.sub
./configure --prefix=/usr --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localsta
tedir=/var/lib --without-krb4 --without-tcl --enable-ipv6 --disable-static -
-with-system-db --localstatedir=/etc --enable-shared --with-system-et --with
-system-ss --enable-dns-for-realm --libdir=/usr/lib64 --build=x86_64-pc-linu
x-gnu
configure: creating cache ./config.cache
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
.
.
.
.
configure: enabling thread support
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for cc_r... x86_64-pc-linux-gnu-gcc
configure: PTHREAD_CC = x86_64-pc-linux-gnu-gcc
configure: PTHREAD_CFLAGS = -pthread
configure: PTHREAD_LIBS =
checking for pthread_once... no
checking for pthread_mutexattr_setrobust_np... no
checking for pthread_rwlock_init... no
configure: rechecking with PTHREAD_... options
checking for pthread_mutexattr_setrobust_np in -lc... yes
checking for pthread_rwlock_init in -lc... yes
configure: disabling static libraries
configure: enabling shared libraries
checking for ANSI C header files... yes
.
.
.
.
make[1]: Entering directory
`/var/tmp/portage/mit-krb5-1.4.3/work/krb5-1.4.3/src/util'
making all in util/support...
make[2]: Entering directory
`/var/tmp/portage/mit-krb5-1.4.3/work/krb5-1.4.3/src/util/support'
x86_64-pc-linux-gnu-gcc -fPIC -DSHARED -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME
=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" 
-DKRB5_PRIVATE=1 -DKRB5_DEPRECATED=1 -DKRB5_DNS_LOOKUP_KDC=1 -DKRB5_DNS_LOOK
UP_REALM=1 -DKRB5_DNS_LOOKUP=1 -DHAVE_LIBRESOLV=1 -DHAVE_RES_NINIT=1 -DHAVE_
RES_NCLOSE=1 -DHAVE_RES_NSEARCH=1 -DHAVE_DN_SKIPNAME=1 -DHAVE_RES_SEARCH=1 -
DHAVE_PRAGMA_WEAK_REF=1 -DDELAY_INITIALIZER=1 -DCONSTRUCTOR_ATTR_WORKS=1 -DD
ESTRUCTOR_ATTR_WORKS=1 -DENABLE_THREADS=1 -DHAVE_PTHREAD=1 -DHAVE_PTHREAD_MU
TEXATTR_SETROBUST_NP_IN_THREAD_LIB=1 -DHAVE_PTHREAD_RWLOCK_INIT_IN_THREAD_LI
B=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_
H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H
=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MEMMOVE=1 -DHAVE_REGCOMP=1 -DG
ETSOCKNAME_ARG2_TYPE=struct\
sockaddr -DGETSOCKNAME_ARG3_TYPE=socklen_t -DGETPEERNAME_ARG2_TYPE=GETSOCKNA
ME_ARG2_TYPE -DGETPEERNAME_ARG3_TYPE=GETSOCKNAME_ARG3_TYPE -DHAVE_LIBUTIL=1 
-DHAVE_SYSLOG_H=1 -DHAVE_STDARG_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_IFADDRS_H=1
 -DHAVE_UNISTD_H=1 -DHAVE_OPENLOG=1 -DHAVE_SYSLOG=1 -DHAVE_CLOSELOG=1 -DHAVE
_STRFTIME=1 -DHAVE_VSPRINTF=1 -DNEED_SWAB_PROTO=1 -DHAVE_STRUCT_SOCKADDR_STO
RAGE=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_NETINET_IN_H=1 -DHA
VE_NETDB_H=1 -DHAVE_INET_NTOP=1 -DHAVE_INET_PTON=1 -DHAVE_GETNAMEINFO=1 -DHA
VE_GETADDRINFO=1 -DKRB5_USE_INET6=1 -DPOSIX_SIGNALS=1 -DUSE_RCACHE=1 -DRETSI
GTYPE=void -DHAVE_GETHOSTBYNAME_R=1 -DHAVE_GETSERVBYNAME_R=1 -DHAVE_GMTIME_R
=1 -DHAVE_LOCALTIME_R=1   -I../../include -I./../../include -I../../include/
krb5 -I./../../include/krb5 -I. -I.  -march=opteron -O3 -pipe -fomit-frame-p
ointer -ftracer -pthread -c threads.c -o threads.so.o && mv -f threads.so.o
threads.so
threads.c: In function `krb5int_pthread_loaded':
threads.c:145: error: `pthread_mutexattr_setrobust_np' undeclared (first use
in this function)
threads.c:145: error: (Each undeclared identifier is reported only once
threads.c:145: error: for each function it appears in.)
make[2]: *** [threads.so] Error 1
make[2]: Leaving d

Re: [gentoo-user] Build error in threads.c, maybe related to nptlonly use flag.

2006-05-12 Thread Richard Fish

On 5/12/06, Bob Young <[EMAIL PROTECTED]> wrote:

checking for pthread_mutexattr_setrobust_np... no



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



RE: [gentoo-user] Build error in threads.c, maybe related to nptlonly use flag.

2006-05-12 Thread Bob Young


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Richard Fish
> Sent: Friday, May 12, 2006 10:48 AM
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] Build error in threads.c, maybe related to
> nptlonly use flag.
> 
> 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:
 
Thanks for the detailed explaination and the solution, much appreciated.

Regards,
Bob Young

-- 
gentoo-user@gentoo.org mailing list