[OT] libtool / ltdl problem .. any advice?



Gnucash is in the middle of a transition to an lt_dlopen-based
plugin/module system.  During this transitional period, we are allowing
plugins to be directly linked against other plugins to handle the
historical linkage spaghetti... eventually we want to disallow this.  

Anyway, we have some special shared libs (the plugins) that can either
be opened directly by lt_dlopen() *or* indirectly by lt_dlopen as a
dependent library of another plugin. 

We are having some very strange problems with this.  The symptom is that
lt_dlopen will sometimes segfault while trying to open a library.  We
have tried to home in on exactly when and why this happens but have been
unsuccessful.  

We've mailed the libtool mailing list to no avail and beat our heads
against it for too long.  This message is a cry for help.  I know it's
off topic for gnome-hackers but I figured, with a usability flamewar
going on, something that can pull everybpdy together is a good solid
round of h8'n for the autotools and libtool :)  

It's hard to tell exactly what's going on.  The closest thing we have to
a smoking gun looks something like this: 

let's say we have two plugins, libplugin-a.la and libplugin-b.la.  
plugin-a needs some symbols that are defined in plugin-b, so the 
Makefile.am for plugin-a has a snippet that looks like this: 

libplugin_a_LDFLAGS=-module
libplugin_a_LIBADD=-L${plugin_b_dir} -L${plugin_b_dir}/.libs -lplugin-b

I know that with libtool-1.4.x, this last line should probably be 

libplugin_a_LIBADD=${plugin_b_dir}/libplugin-b.la

but that doesn't work with libtool-1.3.4, which is what Red Hat ships,
and so we stick to the first syntax, which "works" (i.e. allows things
to link) with both. 

If we link everything together into one big application, there are no
problems.  However, if we have a tiny test program that doesn't link
against either plugin, but dlopens them, sometimes it works, and
sometimes it segfaults. 

It appears that if libplugin-b is lt_dlopened before libplugin-a,
libplugin-a will load successfully, but if libplugin-a is lt_dlopened
first, lt_dlopen will segfault while opening it.

This may not be exactly what's happening.  It's hard to get a test case
that reproduces the problem in a simple and clear way. 

Does this ring any bells with anybody? 

Thanks,
Bill Gribble







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