GstTranscode gir can't be cross compiled because it tries to access target hardware
I have previously been able to cross compile gir for gstreamer, base, good, bad, ugly, and rtsp-server using 1.16.1 and hacking the meson.build to skip the cross compile check. The need to hack the meson.build was fixed recently - see gstreamer#381 (closed)
So I updated all my repos to use the new commits, and found that plugins-bad can no longer cross compile gir. I bisected the problem to the addition of GstTranscode in 7a66b16d which happened after 1.16.1.
The problem appears to be that gir correctly builds the introspection binary and then runs it, but the binary then attempts to open vchiq hardware, which is only present on the real target hardware. qemu cant emulate that, so the binary crashes out and introspection fails. Notably, this does not happen with plugins-base, which also uses the rpi libraries.
The message "* failed to open vchiq instance" comes from the RPi's /opt/vc/lib libraries themselves, not from gstreamer.
Here is the build output:
[7/7] packages.gstreamer:build_repo_meson:62: ninja -C /home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad -j 8
ninja: Entering directory `/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad'
[136/481] Generating GstTranscoder-1.0.gir with a custom command.
FAILED: gst-libs/gst/transcoder/GstTranscoder-1.0.gir
/home/al/Source/rpi-ramdisk/sysroot/wrappers/g-ir-scanner -pthread -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/include/gobject-introspection-1.0 -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/include/glib-2.0 -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include --no-libtool --namespace=GstTranscoder --nsversion=1.0 --warn-all --output gst-libs/gst/transcoder/GstTranscoder-1.0.gir '--add-init-section=extern gboolean gst_init(gint *argc, gchar **argv); gst_init(NULL,NULL);' -I/home/al/Source/rpi-ramdisk/packages/gstreamer/gst-plugins-bad/gst-libs/gst/transcoder -I/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/gst-libs/gst/transcoder -I./. -I../../gst-plugins-bad/. -I./gst-libs -I../../gst-plugins-bad/gst-libs --filelist=/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/gst-libs/gst/transcoder/93e7ff3@@gsttranscoder-1.0@sha/GstTranscoder_1.0_gir_filelist --include=GObject-2.0 --include=Gst-1.0 --include=GstPbutils-1.0 --symbol-prefix=gst_ --identifier-prefix=Gst --cflags-begin -fvisibility=hidden -fno-strict-aliasing -DG_DISABLE_DEPRECATED -Wmissing-prototypes -Wdeclaration-after-statement -Wold-style-definition -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar -Wvla -Wpointer-arith -I./. -I../../gst-plugins-bad/. -I./gst-libs -I../../gst-plugins-bad/gst-libs -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/include/glib-2.0 -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/gstreamer/include/gstreamer-1.0 --cflags-end --add-include-path=/opt/gstreamer/share/gir-1.0 --library gsttranscoder-1.0 -L/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/gst-libs/gst/transcoder -L/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf -L/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/gstreamer/lib --extra-library=gstreamer-1.0 --extra-library=gobject-2.0 --extra-library=glib-2.0 --extra-library=gstpbutils-1.0 --extra-library=gstaudio-1.0 --extra-library=gstvideo-1.0 --extra-library=gstbase-1.0 --sources-top-dirs /home/al/Source/rpi-ramdisk/packages/gstreamer/gst-plugins-bad/subprojects/ --sources-top-dirs /home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/subprojects/
g-ir-scanner: link: arm-linux-gnueabihf-gcc --sysroot=/home/al/Source/rpi-ramdisk/sysroot/sysroot -o /home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/tmp-introspectfh716ncv/GstTranscoder-1.0 /home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/tmp-introspectfh716ncv/GstTranscoder-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/gst-libs/gst/transcoder -Wl,-rpath,/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/gst-libs/gst/transcoder -L/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath,/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf -L/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/gstreamer/lib -Wl,-rpath,/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/gstreamer/lib -lgsttranscoder-1.0 -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -lgstpbutils-1.0 -lgstaudio-1.0 -lgstvideo-1.0 -lgstbase-1.0 -L/home/al/Source/rpi-ramdisk/sysroot/sysroot/usr/lib/arm-linux-gnueabihf -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 --sysroot=/home/al/Source/rpi-ramdisk/sysroot/sysroot -Wl,--rpath-link=/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/vc/lib -Wl,--rpath-link=/home/al/Source/rpi-ramdisk/sysroot/sysroot/opt/gstreamer/lib -Wl,--rpath=/opt/vc/lib -Wl,--rpath=/opt/gstreamer/lib
(GstTranscoder-1.0:3356): GStreamer-WARNING **: 22:35:27.339: External plugin loader failed. This most likely means that the plugin loader helper binary was not found or could not be run. You might need to set the GST_PLUGIN_SCANNER environment variable if your setup is unusual. This should normally not be required though.
* failed to open vchiq instance
Command '['/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/tmp-introspectfh716ncv/GstTranscoder-1.0', '--introspect-dump=/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/tmp-introspectfh716ncv/functions.txt,/home/al/Source/rpi-ramdisk/packages/gstreamer/build/gst-plugins-bad/tmp-introspectfh716ncv/dump.xml']' returned non-zero exit status 255.