GNOME Bugzilla – Bug 674065
Clean up unnecessary linking
Last modified: 2015-02-07 16:49:51 UTC
Currently everything that uses gobject-introspection-1.0.pc to link to libgirepository is also getting linked to libffi. This is caused by Requires: libffi in g-i .pc files. As I understand it, libffi is actually an internal dependency and it's not necessary to link with it in order to use libgirepository public API. There's a libffi soname bump coming to Fedora soon and as it turns out, a large number of modules that use g-i will be broken by the soname change. Most of them, however, are just linking to libffi because it's listed in g-i .pc files and don't actually use any symbols from libffi. It would be nice to avoid such unnecessary linking.
Created attachment 212011 [details] [review] Don't link with gthread-2.0 Commit df189c38 removed the use of g_thread_init() and we don't use any other symbols from gthread-2.0.
Created attachment 212012 [details] [review] Move libffi and gmodule to Requires.private in .pc files The intention of the change is to clean up unnecessary linking with libffi and gmodule in g-i consumers as they typically don't use any libffi/gmodule symbols. Listing libffi and gmodule in pkg-config Requires meant that every consumer that wanted to link with -lgirepository also got -lffi and -lgmodule-2.0, which caused ld to emit unnecessary DT_NEEDED entries. Moving the deps to Requires.private removes the internal dependencies from 'pkg-config --libs', but keeps them in --libs --static output. The change won't affect --cflags and the include directories necessary for <ffi.h> will still be listed.
Review of attachment 212011 [details] [review]: We intended to remove gthread in commit 2fff9866fd7f9de0fb8a7ac08d6c27a14c1f3f42 actually, but yes, this all looks good.
Review of attachment 212012 [details] [review]: "The change won't affect --cflags and the include directories necessary for <ffi.h> will still be listed." I think that's a pkg-config bug...an old one that we can't easily change now. Anyways, looks good.
Review of attachment 212011 [details] [review]: Thanks, updated the commit message and pushed to master as 48f1332.
Review of attachment 212012 [details] [review]: Pushed to master as a847eb8.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]