initialization problems with static p11-kit on mingw

Mark Brand mabrand at mabrand.nl
Sat Oct 29 14:20:15 PDT 2011


>>> (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:
>
> http://www.gossamer-threads.com/lists/gnupg/gcrypt/51757?do=post_view_threaded 
>
>
> https://github.com/Chronic-Dev/libgpg-error/commit/d717d13e27cb02fbbb015854e3811d9b0aad3c06 
>
>
Sorry for replying to my own message, but I thought I should report 
this. Adding a call to _p11_library_init() in main() of 
tools/p11-kit.exe has a promising effect:

wine tools/p11-kit.exe -l
(p11-kit:8) _p11_library_init: initializing library
(p11-kit:8) p11_kit_initialize_registered: in
(p11-kit:8) _p11_conf_parse_file: reading config file: 
/home/brand/projects/mingw-cross-env.dev/local/usr/i686-pc-mingw32/etc/pkcs11/pkcs11.conf
(p11-kit:8) _p11_conf_parse_file: config value: user-config: merge
(p11-kit:8) _p11_conf_parse_file: reading config file: 
C:\windows\profiles\brand/.pkcs11/pkcs11.conf
(p11-kit:8) read_config_file: config file does not exist
(p11-kit:8) load_configs_from_directory: loading module configs in: 
C:\windows\profiles\brand/.pkcs11/modules
(p11-kit:8) load_configs_from_directory: loading module configs in: 
/home/brand/projects/mingw-cross-env.dev/local/usr/i686-pc-mingw32/etc/pkcs11/modules
(p11-kit:8) p11_kit_initialize_registered: out: 0
(p11-kit:8) p11_kit_finalize_registered: in
(p11-kit:8) _p11_kit_finalize_registered_unlocked_reentrant: finalizing 
0 modules
(p11-kit:8) p11_kit_finalize_registered: out: 0

Is the trick now to get this to happen automatically with static linking?

Mark



More information about the p11-glue mailing list