GNOME Bugzilla – Bug 562427
Compilation with --as-needed
Last modified: 2008-11-27 19:25:07 UTC
If all dependencies of gimp are compiled with --as-needed passed to the linker, the linking of gimp-console is missing the references to glib. Attached patch fixes that, please apply.
Created attachment 123528 [details] [review] gimp-2.6.3-asneeded.diff
The glib libs are included in any of GDK_PIXBUF_LIBS, PANGOFT2_LIBS, GEGL_LIBS. I absolutely don't see why this patch is needed. Why do you compile with --as-needed at all?
Gentoo?
They are not if those deps are also compiled with --as-needed. And for the "why"-Question: --as-needed reduces memory footprint (as no unneccessary libraries are loaded) and reduces breakage on api changes, though it's a useful option. See this for further info: http://www.gentoo.org/proj/en/qa/asneeded.xml
"Warning: At the time of writing, there are many packages failing in funny ways because of --as-needed as they weren't designed to be used with it. While there shouldn't be (note the conditional) problems such as crashes, this flag is not considered safe for production use and not supported in any way by Gentoo." So what exactly is the goal of this bug? It would seem to be inconsistent to fix one package if Gentoo itself does not try to make this flag supported.
Gentoo is not the only distribution working on getting --as-needed supported; while it's not possible to tell the user that it's _supported_ as a whole right now, we have to fix stuff to make sure it works. For what it's worth, there are many upstream project that by now actually push for --as-needed by themselves to reduce the number of dependencies, memory footprint and startup times of their application. But --as-needed or not, there is one bug here to fix; the bug is that libgthread is missing in the linking line. I cannot say for sure for gegl since I don't have it here at hand, but at least gdk-pixbuf-2.0 and pangoft2 do _not_ require gthread or push it in their own libraries: flame@yamato ~ % pkg-config --libs gdk-pixbuf-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 flame@yamato ~ % pkg-config --libs pangoft2 -lpangoft2-1.0 -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 The only reason why it works without --at-needed is that incidentally they get linked against libgthread-2.0 and it stays that way, but that's far from being the correct thing at all. Maybe it's of no importance to you, but why refusing to straighten up the linking line while we do our best to improve the situation for final users? By the way if you want more details on how --as-needed works, I wrote quite a few blog posts about it, I can leave you a few links: http://blog.flameeyes.eu/2008/11/19/relationship-between-as-needed-and-no-undefined-part-1-what-do-they-do http://blog.flameeyes.eu/2008/11/20/misguided-link-and-as-needed And you can find the whole series at http://blog.flameeyes.eu/tag/asneeded .
Then --as-needed is simply broken. There are references to glib functions in each single gimp object file, plus glib is pulled in by the FOO_LIBS variables i mentioned above, so if --as-needed thinks glib is not needed, it's clearly --as-needed's fault. Closing as NOTGNOME (for the lack of a GENTOO resolution).
Oh, seems i missed the last comment. I indeed cannot find an explicit or transitive linking of gthread anywhere, and clearly it's in gimp's GLIB_LIBS, reopening.
Fixed in both branches: 2008-11-27 Michael Natterer <mitch@gimp.org> Bug 562427 – Compilation with --as-needed * app/Makefile.am (gimp_console_2_7_LDADD): add $(GLIB_LIBS) so libgthread gets pulled in explicitely.