GNOME Bugzilla – Bug 621611
GIRs must not be distributed
Last modified: 2015-02-07 16:46:19 UTC
The directions for integrating gobject-introspection on l.g.o, which are being incorporated into current packages, contain a serious flaw:
-dist_gir_DATA = $(INTROSPECTION_GIRS)
+gir_DATA = $(INTROSPECTION_GIRS)
By declaring the .gir dist_, it is shipped in tarballs, but .girs are not truly portable: the namespace shared-library attribute varies by platform (e.g. libatk-1.0.so.0 on Linux, cygatk-1.0-0.dll on Cygwin, libatk-1.0-0.dll on MinGW, libatk-1.0.sl.0 on most HPUXs, libatk-1.0.0.dylib on Darwin, etc.).
The problem with this occurs with a VPATH (builddir != srcdir) parallel build. The $builddir .gir is built after the .la is linked, but the %.typelib: %.gir rule picks up the existing $srcdir .gir:
/usr/bin/g-ir-compiler.exe --includedir=. /usr/src/ports/gnome/atk1.0/atk1.0-1.30.0-1/src/atk-1.30.0/atk/Atk-1.0.gir -o Atk-1.0.typelib
The result is the installed .gir is correct but the .typelib is incorrect, and fails to load due to looking for the wrong platform shared-library.
The fix is to change dist_gir_DATA to gir_DATA, as above. This will require changes to l.g.o and all modules using gobject-introspection, although perhaps some workaround can be found for Makefile.introspection in the meantime.
Hmm...can we instead change the shared library attribute to look like:
Or actually...even better, we could nuke it entirely and have the typelib compiler run pkg-config --libs.
(In reply to comment #1)
> Hmm...can we instead change the shared library attribute to look like:
Not as it stands now, because shared-library is derived by giscanner when building the gir, either from the .la dlname or from the linked introspection binary. How would it know what this will look like on all other platforms?
> Or actually...even better, we could nuke it entirely and have the typelib
> compiler run pkg-config --libs.
I don't understand, how would that help?
(In reply to comment #2)
> Not as it stands now, because shared-library is derived by giscanner when
> building the gir, either from the .la dlname or from the linked introspection
> binary. How would it know what this will look like on all other platforms?
> > Or actually...even better, we could nuke it entirely and have the typelib
> > compiler run pkg-config --libs.
> I don't understand, how would that help?
Since the shared-library argument would no longer exist?
My apologies, I honestly haven't studied the internals of gobject-introspection. Without the shared-library attribute, how would the typelib find the C library to do the heavy lifting?
In the .gir we have e.g.:
g-ir-compiler would see that and run `pkg-config --libs gio-2.0` to get the shared library.
On #introspection this evening:
<jdahlin> cygwinports: as we /mostly/ run on linux it makes sense so people can use it without having introspection installed
<jdahlin> but it's getting pretty system dependent already so it might just be better to not dist it.
<cygwinports> how is it usable w/o introspection?
<jdahlin> it's usable by bindings who only parses the xml
<cygwinports> but it's only installed if HAVE_INTROSPECTION, per the latest instructions
<jdahlin> hmm, right
<jdahlin> let's just remove it from the dist then
this means we should also remove
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
(In reply to comment #7)
> this means we should also remove
> DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
You're right that it should no longer be required, since the source tarball will be identical either way, but it's probably not a bad idea to leave it in anyway to make sure that it builds. At least it shouldn't hurt.
Closing this bug, there's no more discussion here.
For the record, there is another reason not to dist girs: introspection format changes break the build if an incompatible version of g-i is used (bug 622378).
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]