custom_target() runs cross executables directly instead of using exe_wrapper
When cross compiling glib, this snippet in gio/tests/meson.build proved problematic:
plugin_resources_c = custom_target('plugin-resources.c',
input : 'test4.gresource.xml',
output : 'plugin-resources.c',
command : [glib_compile_resources,
compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
'--internal',
'--generate-source',
'--c-name', '_g_plugin',
'@INPUT@'])
Specifically, 'command', e,g. 'glib-compile-resources' executable in the build tree, will be executed by meson directly, even though it is is a cross-binary that has just been built, and will not run directly (and the fact is known from needs_exe_wrapper set to true, and exe wrapper pointing to qemu). Glib upstream tries to work around this by wrapping the target in 'if meson.can_run_host_binaries()', but that returns 'true' as well (because the wrapper is available), and so the target is attempted - and fails.
I've filed a quick fix for glib: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3067
but the real issue is probably in meson.