GLib-2.0.gir is in an architecture-independent location, but is architecture-dependent
GLib-2.0.gir contains some architecture-dependent macros and types:
-
SEARCHPATH_SEPARATOR
,SEARCHPATH_SEPARATOR_S
,Pid
(Unix vs. Windows) -
SIZEOF_LONG
,SIZEOF_SIZE_T
,SIZEOF_SSIZE_T
,SIZEOF_VOID_P
,VA_COPY_AS_ARRAY
(C type/calling convention facts) -
SYSDEF_AF_INET
,SYSDEF_MSG_DONTROUTE
etc. (kernel ABI facts) -
GINT16_FORMAT
,GINT16_MODIFIER
etc. (facts about printf)
However, it is installed in ${datadir}
, the directory hierarchy for architecture-independent files (as opposed to ${libdir}
, the directory hierarchy for architecture-dependent files).
This means in particular that if you're cross-compiling, or mixing architectures on one system with Red-Hat-style biarch (lib, lib64) or Debian-style multiarch (lib/i386-linux-gnu, lib/x86_64-linux-gnu), then the copy of GLib-2.0.gir in /usr/share is likely to contain facts that are wrong for either the host (cross) architecture or the build (native) architecture.
The typelib compiled from the XML does not have this problem: it is installed in ${libdir}/girepository-1.0
, which is for example .../lib64/...
on Red-Hat-style systems or .../lib/x86_64-linux-gnu/...
on Debian-style systems.
Possible solutions include:
-
Remove these macros and types from the GIR XML. They're probably uninteresting to introspected languages like JavaScript and Python anyway (although they are likely to be more interesting to languages that generate architecture-dependent code, like Vala, and perhaps to documentation tools).
-
Remove these macros' and types' values and source positions from the GIR XML, but keep the fact that they exist, and their C names.
-
Introduce a new architecture-dependent location for GIR XML (probably the same place as typelibs:
${GI_TYPELIB_PATH}
, defaulting to${libdir}/girepository-1.0
), move GLib's GIR XML there, and teach consumers of this information to load from there in addition to${XDG_DATA_DIRS}/gir-1.0
. -
Keep the majority of GLib's GIR XML in
${datadir}
, but have some way to offload the architecture-dependent parts to a separate file in${libdir}/girepository-1.0
or similar.