Bug 212026 - [GTK] Allow gtk-doc and introspection in cross builds
Summary: [GTK] Allow gtk-doc and introspection in cross builds
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-18 07:58 PDT by Michael Catanzaro
Modified: 2020-05-18 13:38 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.28 KB, patch)
2020-05-18 08:00 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2020-05-18 07:58:40 PDT
See https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/76

OptionsGTK.cmake contains:

# Override the cached variables, gtk-doc and gobject-introspection do not really work when cross-building.
if (CMAKE_CROSSCOMPILING)
    set(ENABLE_GTKDOC OFF)
    set(ENABLE_INTROSPECTION OFF)
endif ()

But in fact, if we remove these lines, cross building works perfectly fine. We've been patching out these lines when building the GNOME runtimes because we cross-build i386 and armv7 packages and obviously need introspection to work.

These lines were added way back in r186259, so I can only presume something has changed somewhere such that it's no longer a problem, because both work perfectly fine. We have very simple CMake toolchain files that just set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR, which is minimum required when cross building with CMake, so if it works for us I assume it should work for anyone....
Comment 1 Michael Catanzaro 2020-05-18 08:00:12 PDT
Created attachment 399647 [details]
Patch
Comment 2 Adrian Perez 2020-05-18 09:14:30 PDT
Comment on attachment 399647 [details]
Patch

I think this is from before the times packagers figured out that they
could run gtk-doc and/or g-ir-scanner/g-ir-generate using qemu userspace
emulation to allow running code for the target platform when doing a
cross-compiled build. While that's a terrible hack and ideally GTK-Doc
and GI should support cross-compilation better, it's true that it is
no longer needed to forcibly disable these two options 🤔️

Let's land this.
Comment 3 EWS 2020-05-18 09:20:13 PDT
Committed r261814: <https://trac.webkit.org/changeset/261814>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 399647 [details].
Comment 4 Michael Catanzaro 2020-05-18 10:00:48 PDT
I'm pretty sure we're not using qemu or anything special? *shrug*
Comment 5 Adrian Perez 2020-05-18 13:22:13 PDT
(In reply to Michael Catanzaro from comment #4)
> I'm pretty sure we're not using qemu or anything special? *shrug*

In case you feel like doing some oddball build tooling archeology...

I have no idea how Fedora (which I suppose is the “we” there) wrangles
this, but I am sure that's how Yocto and Buildroot do it:

  https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/gobject-introspection.bbclass#n28
  https://git.busybox.net/buildroot/tree/package/gobject-introspection/gobject-introspection.mk#n96

As for Flatpak, if you do a cross-build the whole build sandbox runs
inside the qemu userspace emulator.
Comment 6 Michael Catanzaro 2020-05-18 13:36:55 PDT
(In reply to Adrian Perez from comment #5)
> I have no idea how Fedora (which I suppose is the “we” there) wrangles
> this, but I am sure that's how Yocto and Buildroot do it:

No, Fedora never cross builds anything, we do native builds only. Maybe armv7 builds are done in a VM or something, dunno. Here "we" is GNOME, I'm trying to upstream this GNOME patch.

> As for Flatpak, if you do a cross-build the whole build sandbox runs
> inside the qemu userspace emulator.

Probably that explains why it works for GNOME.
Comment 7 Michael Catanzaro 2020-05-18 13:38:07 PDT
(In reply to Michael Catanzaro from comment #6)
> No, Fedora never cross builds anything, we do native builds only. Maybe
> armv7 builds are done in a VM or something, dunno. Here "we" is GNOME, I'm
> trying to upstream this GNOME patch.

Ugh, sorry. There "we" in the first sentence meant Fedora, and in the third second meant GNOME. I can probably change my "we" multiple times in the same sentence if not careful. So many hats....