Hello! I'd like to have some input on the following issue. This is the underlying problem of recent (newer than 0.14.5, I think) versions of GNU gettext failing to build for us.
#v+ $ git clone git://git.sv.gnu.org/gnulib.git $ cd gnulib $ ./gnulib-tool --dir=test-lock --create-testdir lock [...] $ mkdir test-lock/build $ cd test-lock/build $ ../configure [...] checking whether imported symbols can be declared weak... yes checking pthread.h usability... yes checking pthread.h presence... yes checking for pthread.h... yes checking for pthread_kill in -lpthread... yes checking for pthread_rwlock_t... yes checking for multithread API to use... posix [...] $ make [...] $ cat > t.c #include "config.h" #include "lock.h" int main() { gl_rwlock_t foo; gl_rwlock_destroy (foo); return 0; } #v- #v+ $ uname -a GNU flubber 0.3 GNU-Mach 1.3.99/Hurd-0.3 i686-AT386 GNU $ gcc -Wall t.c -I../gllib -Lgllib -lgnu gllib/libgnu.a(lock.o): In function `pthread_rwlock_destroy': /usr/include/bits/rwlock.h:68: undefined reference to `_pthread_rwlock_destroy' collect2: ld returned 1 exit status #v- #v+ $ uname -a Linux dirichlet 2.6.20-12-generic #2 SMP Sun Mar 18 03:07:14 UTC 2007 i686 GNU/Linux $ gcc -Wall t.c -I../gllib -Lgllib -lgnu $ echo $? 0 #v- So, where does this stem from? The Hurd's libpthread has an optimization (provided in the header files), looking as follows: #v+ _EXTERN_INLINE int pthread_rwlock_destroy (struct __pthread_rwlock *__rwlock) { extern int _pthread_rwlock_destroy (struct __pthread_rwlock *); if (__rwlock->__attr || __rwlock->__data) return _pthread_rwlock_destroy (__rwlock); return 0; } #v- The symbol `_pthread_rwlock_destroy' is provided in the pthread library file, which is not linked against by default, so our current libpthread implementation in fact asserts that if <pthread.h> is included, `-lpthread' will also be given when linking. -- But the gnulib code does not neccessarily enforce that. For the Linux case, the nptl seems not to do such a thing, so it works as expected. So, should the Hurd's libpthread be changed or which other possibilities are there? I might also note that if replacing the `rwlock' with, e.g., a `lock' (i.e. `pthread_mutex_destroy') this problem does not occur. (Why?) Regards, Thomas
signature.asc
Description: Digital signature
_______________________________________________ Bug-hurd mailing list Bug-hurd@gnu.org http://lists.gnu.org/mailman/listinfo/bug-hurd