plugin fails to link to gtk

Bug #1000818 reported by RedDwarf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Lightspark
New
Undecided
Unassigned

Bug Description

src/plugin/plugin.cpp uses gtk_plug_new(), so it should directly link to GTK.

Patch attached.

Revision history for this message
RedDwarf (cmorve69) wrote :
Revision history for this message
Alessandro Pignotti (a-pignotti) wrote :

I suspect that linking the whole GTK_LIBRARIES group will overlink. It was removed in commit 083bbd74836f3a8c4b38d8d05aa2f04661064272 for that reason. Could you confirm that no useless libraries are linked when GTK_LIBRARIES is used?

Revision history for this message
RedDwarf (cmorve69) wrote :

In my system it means: -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0

Of those gmodule-2.0, gobject-2.0, glib-2.0, rt and gthread-2.0 already come anyway from gtkmm. But now I noticed that is not only GTK but GTK and GTHREAD (g_thread_init() in plugin.cpp) the missing libs. Updated patch attached.

If you think any of those libraries shouldn't be there it would be better to report the bug to gtk so they fix its .pc file. But notice that even if *right now* -lgio-2.0 is not really needed, it could be in the future. Right now the plugin ends with a DT_NEEDED entry for glib-2.0 even if your code doesn't use a single function or variable from glib. That's because glib/gtk have the weird habit of adding these dependencies in the headers through macros. The macros can change to add dependencies in any future release (they are not breaking anything because they are giving you the libraries through pkg-config, but you are supposed to use them).

Anyway, since you use -Wl,--as-needed only the actually required libraries are added as DT_NEEDED entries in the final plugin. They being in the command line are not a real problem. At least in any modern RPM* system the dependencies are extracted automatically from the pkg-config, so the extra libraries are warranted to be available.

* I don't know if deb files do the same. But if the Debian gtk-devel package doesn't require all the libraries indicated in the "Requires" field of the .pc file IMHO it's a packaging bug. The .pc file is always correct by definition.

Revision history for this message
RedDwarf (cmorve69) wrote :

As an example of the macros thing. You use "g_thread_supported()" in plugin.cpp. But in /usr/include/glib-2.0/glib/gthread.h (at least in gthread 2.30.1) it is a macro defined as "g_threads_got_initialized". And the g_thread_supported symbol is not in libgthread-2.0 but in ibglib-2.0. That's why liblightsparkplugin.so depends on glib-2.0 (but you don't need to explicitly link against glib, the dependency comes indirectly from the gthread pkg-config file).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.