"Generating […].gir with a custom command" / "g-ir-scanner" fails when building with crossdirect for armv7
This issue summarizes what we've seen in build.postmarketos.org#152 (closed) and pmaports#2820 (closed).
- Building some GTK projects for
armv7
fails when runningg-ir-scanner
with various asserts. - Apparently the bug does not always happen (build.postmarketos.org#152 (comment 469485)).
- It is reliably worked around when disabling crossdirect (v1 and upcoming v2 !2474 (comment 469455)) by using
options="!pmb:crossdirect"
in theAPKBUILD
.
What does crossdirect do?
- When crossdirect is disabled,
armv7
binaries are used for all parts of the build, running through QEMU. - When crossdirect is enabled, the
x86_64
binary of thegcc-armv7
cross compiler gets used instead of runninggcc
through QEMU. armv7g-ir-scanner
still runs through QEMU.
Where is the bug?
My current theory is the following.
The bug is in one of these components, or possibly in multiple:
- gcc (when built as cross compiler for x86_64 -> armv7)
- QEMU
- build-system (meson)
g-ir-scanner
It looks like binaries generated by gcc armv7 through QEMU vs. gcc to armv7 cross compiler are slightly different (which could be a bug in QEMU or gcc).
g-ir-scanner
then runs into asserts for those, which could be:
- a bug in
g-ir-scanner
- a bug in QEMU
- a bug in mesonbuild
- not a bug if the binaries generated earlier are really broken in a way they trigger the asserts
Next steps
To analyze this further, we could diff the binaries generated with/without crossdirect.
- Are they really different? If not, then my theory above does not make sense.
- Where are they different?
- What caused them to be different? (gcc or qemu?)
- Are they valid or not? (-> do the asserts trigger properly?)
(I won't spend more time on this now, but for future reference.)
Error messages
Phosh (from build.postmarketos.org#152 (closed)):
(process:12516): GLib-GObject-CRITICAL **: 19:01:31.389: g_param_spec_double: assertion 'default_value >= minimum && default_value <= maximum' failed
(process:12516): GLib-GObject-CRITICAL **: 19:01:31.390: validate_pspec_to_install: assertion 'G_IS_PARAM_SPEC (pspec)' failed
(process:12516): GLib-GObject-CRITICAL **: 19:01:31.390: g_param_spec_ref_sink: assertion 'G_IS_PARAM_SPEC (pspec)' failed
(process:12516): GLib-GObject-CRITICAL **: 19:01:31.391: g_param_spec_unref: assertion 'G_IS_PARAM_SPEC (pspec)' failed
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Mutter (pmaports#2820 (closed)):
(process:56814): GLib-GObject-CRITICAL **: 18:33:05.900: validate_pspec_to_install: assertion 'G_IS_PARAM_SPEC (pspec)' failed
(process:56814): GLib-GObject-CRITICAL **: 18:33:05.901: g_param_spec_ref_sink: assertion 'G_IS_PARAM_SPEC (pspec)' failed
(process:56814): GLib-GObject-CRITICAL **: 18:33:05.901: g_param_spec_unref: assertion 'G_IS_PARAM_SPEC (pspec)' failed
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Edited by Jane Rachinger