bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libpthread not loading indirectly?


From: Neal H. Walfield
Subject: libpthread not loading indirectly?
Date: Mon, 02 May 2005 17:09:51 +0100
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

Hi Roland,

We've encountered a rather strange linking problem.  gconftool-2 (part
of gconf) uses libxml which in turn uses libpthread.  gconftool-2 does
not directly need libpthread and hence does not need to link against
it.  When gconftool-2 is run, an assertion is triggered which
indicates that _cthread_init_routine is never called (which would be
because _cthread_init_routine is null in
sysdeps/mach/hurd/i386/init_first.c:init).  I've created the following
test program to demonstrate the problem:

  #include <stdio.h>
  #include <libxml/xmlversion.h>
  
  int
  main ()
  {
    xmlCheckVersion (0);
  }
  
  /*
     Local Variables:
     compile-command: "LDLIBS=-lxml2 CFLAGS=-I/usr/include/libxml2 make 
pthread-linking"
     End:
  */


Compiling it and running it indeed yields the same assertion as
gcontool-2:

  $ ./pthread-linking 
  pthread-linking:
  
/build/mbanck/hurd-20050119/build-tree/hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c:55:
  __pthread_mutex_timedlock_internal: Assertion `__pthread_threads'
  failed.
  Aborted

objdump reveals that it does not have a DT_NEEDED referencing
libpthread:

  $ objdump -x pthread-linking | grep NEEDED
    NEEDED      libxml2.so.2
    NEEDED      libc.so.0.3

while libxml2 does:

  $ objdump -x /lib/libxml2.so | grep NEEDED
    NEEDED      libpthread.so.0.3
    NEEDED      libz.so.1
    NEEDED      libm.so.6
    NEEDED      libc.so.0.3

When we recompile the test program and add -lpthread to LDLIBS (to get
a DT_NEEDED for libpthread in the pthread-linking itself),
_cthread_init_routine is correctly called.

Do you have any idea what may be the problem?

Thanks,
Neal





reply via email to

[Prev in Thread] Current Thread [Next in Thread]