[Pidgin] #7872: Libpurple plugins can't find purple_* symbols when libpurple.so is loaded dynamically.

Pidgin trac at pidgin.im
Tue Dec 30 10:46:40 EST 2008


#7872: Libpurple plugins can't find purple_* symbols when libpurple.so is loaded
dynamically.
-----------------------------------------------------+----------------------
 Reporter:  brunoabinader                            |        Owner:           
     Type:  defect                                   |       Status:  new      
Milestone:                                           |    Component:  libpurple
  Version:  2.5.3                                    |   Resolution:           
 Keywords:  libpurple, LD_PRELOAD, undefined symbol  |  
-----------------------------------------------------+----------------------

Comment(by fredymade):

 Replying to [ticket:7872 brunoabinader]:
 >...
 >...


 I did a little debugging work with the ''nullclient.py''.

 Using '''GDB''', i managed to discover where exactly the problem
 occurs.[[BR]]
 It happens when the protocol's plugins are being probed inside the
 libpurple[[BR]]
 function '''void purple_plugins_probe(const char *)''' [''plugin.c''].

 I set a couple of breakpoints inside the libpurple code to track it.[[BR]]
 More specifcally, at the functions '''purple_plugins_probe''',[[BR]]
 '''purple_plugin_probe''' and '''g_module_open'''[''Glib'' function].

 {{{
 purple_plugins_probe (ext=0xb7c2612c "so") at plugin.c:1355
 1355                    g_free(path);
 (gdb) n
 1348                while ((file = g_dir_read_name(dir)) != NULL)
 (gdb) n
 1350                    path = g_build_filename(search_path, file, NULL);
 (gdb) n
 1352                    if (ext == NULL || has_file_extension(file, ext))
 (gdb) n
 1355                    g_free(path);
 (gdb) n
 1348                while ((file = g_dir_read_name(dir)) != NULL)
 (gdb) n
 1350                    path = g_build_filename(search_path, file, NULL);
 (gdb) n
 1352                    if (ext == NULL || has_file_extension(file, ext))
 (gdb) n
 1353                        plugin = purple_plugin_probe(path);
 (gdb) n

 Breakpoint 2, purple_plugin_probe (filename=0x81f0c08
 "/usr/lib/purple-2/libicq.so") at plugin.c:209
 209     purple_debug_misc("plugins", "probing %s\n", filename);
 (gdb) n
 (13:31:22) plugins: probing /usr/lib/purple-2/libicq.so
 210     g_return_val_if_fail(filename != NULL, NULL);
 (gdb) n
 212     if (!g_file_test(filename, G_FILE_TEST_EXISTS))
 (gdb) n
 216     basename = purple_plugin_get_basename(filename);
 (gdb) n
 217     plugin = purple_plugins_find_with_basename(basename);
 (gdb) n
 218     g_free(basename);
 (gdb) n
 217     plugin = purple_plugins_find_with_basename(basename);
 (gdb) n
 218     g_free(basename);
 (gdb) n
 219     if (plugin != NULL)
 (gdb) n
 241     plugin = purple_plugin_new(has_file_extension(filename,
 G_MODULE_SUFFIX), filename);
 (gdb) n
 243     if (plugin->native_plugin) {
 (gdb) n
 257         plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL);
 (gdb) n

 Breakpoint 3, 0xb809c5b6 in g_module_open () from
 /usr/lib/libgmodule-2.0.so.0
 (gdb) n
 Single stepping until exit from function g_module_open,
 which has no line number information.
 purple_plugin_probe (filename=0x81f0c08 "/usr/lib/purple-2/libicq.so") at
 plugin.c:262
 262         if (plugin->handle == NULL)
 (gdb) n
 257         plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL);
 (gdb) n
 262         if (plugin->handle == NULL)
 (gdb) n
 264             const char *error = g_module_error();
 (gdb) n
 265             if (error != NULL && purple_str_has_prefix(error,
 filename))
 (gdb) n
 264             const char *error = g_module_error();
 (gdb) n
 265             if (error != NULL && purple_str_has_prefix(error,
 filename))
 (gdb)
 277             if (error == NULL || !*error)
 (gdb) n
 285                 plugin->error = g_strdup(error);
 (gdb) n
 286                 purple_debug_error("plugins", "%s is not loadable:
 %s\n",
 (gdb) n
 (13:31:44) plugins: /usr/lib/purple-2/libicq.so is not loadable:
 /usr/lib/purple-2/liboscar.so.0: undefined symbol:
 purple_prefs_connect_callback
 290             plugin->handle = g_module_open(filename,
 G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
 (gdb) n

 Breakpoint 3, 0xb809c5b6 in g_module_open () from
 /usr/lib/libgmodule-2.0.so.0
 (gdb) n
 Single stepping until exit from function g_module_open,
 which has no line number information.
 purple_plugin_probe (filename=0x81f0c08 "/usr/lib/purple-2/libicq.so") at
 plugin.c:295
 295             if (plugin->handle == NULL)
 (gdb) n
 290             plugin->handle = g_module_open(filename,
 G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
 (gdb) n
 295             if (plugin->handle == NULL)
 (gdb) n
 310                 plugin->unloadable = TRUE;
 (gdb) n
 314         if (!g_module_symbol(plugin->handle, "purple_init_plugin",
 (gdb) n
 336         purple_init_plugin = unpunned;
 (gdb) n
 354     if (!purple_init_plugin(plugin) || plugin->info == NULL)
 (gdb) n






 /usr/bin/python: symbol lookup error: /usr/lib/purple-2/liboscar.so.0:
 undefined symbol: purple_account_option_string_new

 Program exited with code 0177.
 (gdb)
 }}}

 As you can see, '''purple_plugins_probe''' probes for each plugin
 with[[BR]]
 '''purple_plugin_probe'''. Then, '''purple_plugin_probe''' calls the glib
 function[[BR]]
 '''g_module_open''' and this function returns a plugin that is not
 loadable.

 The problem occurs when probing the plugin ''libicq.so'', but i
 think[[BR]]
 the same applies when probing the plugin ''ssl-nss.so''.

 No idea why this happens and i haven't tried rebuilding my GLIB because
 i'm worried[[BR]]
 that it'll messup my system.

 Any suggestions??

-- 
Ticket URL: <http://developer.pidgin.im/ticket/7872#comment:2>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list