undefined symbol: glade_module_register_widgets
1. Problem
Certain Gnome/GTK+ applications, upon start, would print an error message such as this on the console:
(kino:5848): libglade-WARNING **: could not find `gnome' init function:
`glade_module_register_widgets': /opt/.system/lib/libgmodule-2.0.so.0:
undefined symbol: glade_module_register_widgets
…after which they crash horribly. Some applications do not crash right away, they wait until I enter a menu or a preferences dialogue.
Examples of crashing applications: Galeon, Epiphany, Kino, Gnotime.
2. Research
libgmodule-2.0.so.0 (part of glib) indeed doesn’t have that symbol defined. Couldn’t get it in there no matter how many time and how I’d recompile glib.
For a long time, nobody seemed able to explain why this happens. I compile my own GTK+ and Gnome and so on packages by hand, and I install each of them to their own /opt directory. As far as I can tell, I’m putting everything that’s needed in them. Other application manage to run just fine.
Some people mentioned something about “libglade lacking Gnome support”. No clue about that.
A misleading changelog note in the glib source code seems to hint that the symbol was deprecated(!!) and replaced by something else, at least that’s one way to interpret the note.
3. Solution
The missing symbol is defined in a library “hidden” among the libgnomeui package files. Apparently, libglade uses a “plugin” sort of a system, where missing parts in it will be later defined by other packages.
This is the case with libgnomeui, which offers the infamous gnome_module_register_widgets. Ah, but it doesn’t put it in any of the regular libraries. It puts it in a libgnome.so library hidden under lib/libglade/2.0 among its files.
As some of you may have already guessed, preloading that library whenever I need to run one of the faulty apps will solve the problem. Example:
LD_PRELOAD="/opt/libgnomeui/lib/libglade/2.0/libgnome.so" kino
But why doesn’t that little library get picked up by itself? Apparently, it has to do with me installing packages into a non standard location (/opt/libgnomeui). So other libs don’t know where to find it.
The ultimate solution: there’s an environment variable which can be used to point out its location.
export LIBGLADE_MODULE_PATH=/opt/libgnomeui/lib/libglade/2.0
Just make sure you have this variable in the environment, and problem solved. Phew. I’ve been hunting this one down for years now.
