u/OzzyOPorosis

▲ 6 r/Gentoo

Is it even possible to cross-compile with introspection?

EDIT: I successfully compiled dev-libs/glib[introspection] and dev-libs/gobject-introspection in a QEMU chroot by commenting out of my make.conf CBUILD, CHOST, ROOT, PORTAGE_TMPDIR, and PKG_CONFIG_DIR.

I've been making a cross compiler from an x86-64 host to an arm64 target. I recall reading that cross-compiling with introspection is tricky because it requires target code to execute on the host machine. I thought registering a QEMU interpreter with binfmt_misc would resolve this, but it hasn't entirely.

The two problematic packages are dev-libs/glib[introspection] and dev-libs/gobject-introspection. These packages require each other, creating a circular dependency. The dev-libs/glib ebuild attempts to resolve this by "bootstrapping" gobject-introspection, which is where the build consistently fails.

Emmanuele Bassi from the GNOME team says this is the recommended way to build:

  1. build GLib with -Dintrospection=disabled
  2. build gobject-introspection
  3. build GLib with -Dintrospection=enabled

I can do the first step just fine: USE="-introspection" aarch64-unknown-linux-gnu-emerge --oneshot dev-libs/glib

I expect the second step to be something like: aarch64-unknown-linux-gnu-emerge dev-libs/gobject-introspection

However, has dev-libs/glib[introspection] as a strict dependency, effectively skipping to the third step before the second can be completed. The build fails as it did before because the existing dev-libs/glib is simply ignored.

I've scoured the wiki for solutions but so far I can't find any. Is there a way to trick portage into ignoring the dependency somehow? Is there a more idiomatic Gentoo solution?

reddit.com
u/OzzyOPorosis — 2 days ago