After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 562427 - Compilation with --as-needed
Compilation with --as-needed
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-11-27 08:50 UTC by Hanno Böck
Modified: 2008-11-27 19:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gimp-2.6.3-asneeded.diff (249 bytes, patch)
2008-11-27 08:51 UTC, Hanno Böck
none Details | Review

Description Hanno Böck 2008-11-27 08:50:23 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.
Comment 1 Hanno Böck 2008-11-27 08:51:21 UTC
Created attachment 123528 [details] [review]
gimp-2.6.3-asneeded.diff
Comment 2 Michael Natterer 2008-11-27 09:16:26 UTC
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?
Comment 3 Tor Lillqvist 2008-11-27 10:00:15 UTC
Gentoo?
Comment 4 Hanno Böck 2008-11-27 10:26:16 UTC
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
Comment 5 Michael Schumacher 2008-11-27 10:53:16 UTC
"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.
Comment 6 Diego Elio Pettenò 2008-11-27 11:32:42 UTC
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 .
Comment 7 Michael Natterer 2008-11-27 12:52:21 UTC
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).
Comment 8 Michael Natterer 2008-11-27 12:56:52 UTC
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.
Comment 9 Michael Natterer 2008-11-27 19:25:07 UTC
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.