initialization problems with static p11-kit on mingw

Mark Brand mabrand at
Sat Oct 29 13:49:45 PDT 2011

Stef Walter wrote:
> Are you trying to use a PKCS#11 module, if so which one? I'd like to 
> test with it too.
My goal for the moment is modest. I just want to be able to statically 
link to p11-kit and start the applicaiton without hanging. I'm not 
really a p11-kit user yet. Just working on upgrading gnutls in 

>> Running p11-kit.exe under Wine produces:
>> (p11-kit:40) p11_kit_initialize_registered: in
>> err:ntdll:RtlpWaitForCriticalSection section 0x4fcce0 "?" wait timed out
>> in thread 0029, blocked by 0000, retrying (60 sec)
>> etc..
>> The line number in p11-kit can vary. I've seen from 13 to 70.
>> When run on Windows 7, it just crashes.
>> Using gdb I set a breakpoint at p11_kit_initialize_registered().
>> (gdb) backtrace
>> #0  p11_kit_initialize_registered () at modules.c:719
>> #1  0x00401f98 in list_modules (argc=0, argv=0x110458) at p11-kit.c:217
>> #2  0x00424952 in main (argc=0, argv=<optimized out>) at p11-kit.c:272
>> This is where it's stuck:
>> (gdb) next
>> p11_kit_initialize_registered () at modules.c:727
>> 727             _p11_lock ();
>> (gdb) next
> Looks like maybe the lock didn't get initialized properly. I've added
> debugging. Can you run with the following env variable P11_KIT_DEBUG=all
> and post the output?

No new output at all. In fact, I set a breakpoint at _p11_library_init, 
but execution doesn't seem to get there. My hunch is that library 
initialization depens on dynamic library loading. The possibly related 
libgpg-error thread and patch is here:


More information about the p11-glue mailing list