mirzak / meta-coral

Yocto/OE-core BSP Layer for Coral Dev Board
MIT License
40 stars 21 forks source link

Missing gstreamer1.0-plugins-base introspection files (.typelib) #26

Open mirzak opened 4 years ago

mirzak commented 4 years ago

The error typically manifests it self in something like this,

root@coral-dev:~# gst-inspect-1.0 python
Traceback (most recent call last):
  File "/usr/lib/gstreamer-1.0/python/glbox.py", line 23, in <module>
    gi.require_version('GstGL', '1.0')
  File "/usr/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GstGL not available
Traceback (most recent call last):
  File "/usr/lib/gstreamer-1.0/python/glsvgoverlaysrc.py", line 28, in <module>
    gi.require_version('GstVideo', '1.0')
  File "/usr/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GstVideo not available
Traceback (most recent call last):
  File "/usr/lib/gstreamer-1.0/python/glsvgoverlaysink.py", line 29, in <module>
    gi.require_version('GstAllocators', '1.0')
  File "/usr/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GstAllocators not available

We can also clearly see that they are missing if we try to search for them:

root@coral-dev:~# find / -name *.typelib | grep Gst                                                                   
/usr/lib/girepository-1.0/GstCheck-1.0.typelib
/usr/lib/girepository-1.0/GstBase-1.0.typelib
/usr/lib/girepository-1.0/GstController-1.0.typelib
/usr/lib/girepository-1.0/Gst-1.0.typelib
/usr/lib/girepository-1.0/GstNet-1.0.typelib

The GstGL, GstVideo and GstAllocators are typically provided by the gstreamer1.0-plugins-base package.

But we are using gstreamer1.0-plugins-base_1.14.imx which has disabled introspection due to an build error as can be seen here

Pretty much all the demo applications that relate to video streams provided by Coral rely on gstreamer introspection files.

I have looked at how this is built in Mendel OS, but it also has disabled introspection as can be seen here. So I think they only way this can work in Mendel OS is because introspection files are provided as separate package, gir1.2-gst-plugins-base-1.0.

So my conclusion is that the typelib files used in Mendel OS are not built from the gstreamer1.0-plugins-base_1.14.imx and instead are using the upstream files of the same package.

Need to figure out a workaround for this in Yocto.

mbrooksx commented 4 years ago

In Mendel the way it's done is that introspection is explicitly disabled in the gstreamer imx package (https://coral.googlesource.com/imx-gst-plugins-base-debian/+/refs/heads/master/debian/rules#131) and then edgetpuvision has the appropriate dependency: https://coral.googlesource.com/edgetpuvision/+/refs/heads/release-day/debian/control#14

mirzak commented 4 years ago

Thanks for the link and for confirming my suspicion :). This is not hard to solve but since there is no concept of gir packages in Yocto it would be a hack at best. I guess this will go away for the 1.16 release of gstreamer-imx which do seem to have introspection enabled.

ftagius commented 4 years ago

I have (mostly) enabled introspection, and the build of GstAllocators, with this patch:

diff --git a/meta-coral-bsp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.14.imx.b
bappend b/meta-coral-bsp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.14.imx.bbap
pend
index bd11f4d..57e06fd 100644
--- a/meta-coral-bsp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.14.imx.bbappend
+++ b/meta-coral-bsp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.14.imx.bbappend
@@ -24,3 +24,20 @@ SRC_URI_append_coral-dev = " \
     file://0016-fdmem-always-map-dmabuf-with-PROT_WRITE.patch \
     file://0017-Tightly-pack-RGB-buffers-downloaded-from-GPU.patch \
 "
+# enabling introspection requires additional dependencies on native packages
+DEPENDS += " \
+       qemu-native \
+       prelink-native \
+       gobject-introspection-native \
+       "
+
+# enable introspection
+EXTRA_OECONF_append = " --enable-introspection"
+
+# add extra lib paths, including allocators, which is needed for introspection
+do_compile_prepend() {
+        export GIR_EXTRA_LIBS_PATH="${B}/gst-libs/gst/tag/.libs:${B}/gst-libs/gst/video/.libs:${B}/gst-libs/gst/audio/.libs:${B}/gst-libs/gst/rtp/.libs:${B}/gst-libs/gst/allocators/.libs"
+}
+
+# add the files generated by introspection
+FILES_${PN} += "${prefix}/share"

The only issue is the "export GIR_EXTRA_LIBS_PATH" do_compile prepend. That line in my patch is put first in the run_compile script, but immediately after it is the original "export GIR_EXTRA_LIBS_PATH" from the freescale bb recipe, overwriting my change. I have not found a way for the bbappend do_compile_prepend to be listed after the do_compile_prepend of the freescale bb recipe. I hacked around it by putting my "export GIR_EXTRA_LIBS_PATH" statement in the freescale bb.

mirzak commented 4 years ago

I have (mostly) enabled introspection, and the build of GstAllocators, with this patch:

Maybe it is actually worth sending a patch towards meta-freescale to fix this.