Problems running kinit on HP-UX 11.00, 11i

Albert Chin kerberos at mlists.thewrittenword.com
Thu May 12 22:17:30 EDT 2005


On Thu, May 12, 2005 at 06:51:52PM -0400, Ken Raeburn wrote:
> But we're attempting to find out *if* we're linked with the pthread
> library, not require it, when that's possible.  For simple
> applications it wouldn't matter much, but we eventually want our
> library to be dynamically loadable from both threaded and
> non-threaded applications, and forcing the pthread library to be
> loaded into a non-threaded application would do bad things.
> 
> When a system has weak symbols, this may be possible.  But we need
> to know what symbol to test for, and that seems to vary across
> systems.  It needs to be something that exists in the pthread
> library but not in the main C library.  On some systems pthread_once
> has worked; on others, apparently it does not.
> 
> Does HP-UX 11 have stubs for pthread_create? pthread_join?

Yes.

> (Other means for figuring out if the thread library is loaded would be 
> useful, but I don't think the pthread interface gives us much besides, 
> for example, invoking pthread_create and seeing that it fails.  Or 
> perhaps, in fact, I should consider setting up a test that invokes 
> pthread_once, and notes that it returns no error and fails to invoke 
> the specified function....)

I think this would be better. I ran the following test:
  $ cat a.c
#include <pthread.h>
#include <stdio.h>

void
init (void) {
  puts ("a");
}

int
main (void) {
  pthread_once_t once_control = PTHREAD_ONCE_INIT;

  if (pthread_once (&once_control, init)) {
    puts ("fail");
  }
}

  $ uname -a
  HP-UX hulk B.11.11 U 9000/785 2010914556 unlimited-user license
  $ cc a.c && ./a.out
  $ cc -mt a.c && ./a.out
a

  $ uname -a
SunOS gax 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V250
  $ cc a.c && ./a.out
  $ cc -mt a.c && ./a.out
a

  $ uname -a
OSF1 gen.il.thewrittenword.com V5.1 732 alpha
  $ cc a.c && ./a.out
ld:
Unresolved:
__pthread_once
  $ cc -pthread pth.c && ./a.out
a

  $ uname -a
AIX luna 2 5 0043880C4C00
  $ xlc a.c && ./a.out
ld: 0711-317 ERROR: Undefined symbol: .pthread_once
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
  $ xlc_r pth.c && ./a.out          
a
  $ xlc pth.c -lpthread && ./a.out
a

  $ uname -a
IRIX64 puar 6.5 01080747 IP30
  $ cc pth.c && ./a.out
ld32: ERROR   33 : Unresolved text symbol "pthread_once" -- 1st
referenced by pth.o.
        Use linker option -v to see when and which objects, archives
and dsos are loaded.
  $ cc pth.c -lpthread && ./a.out
a

-- 
albert chin (china at thewrittenword.com)


More information about the Kerberos mailing list