linuxdeploy / linuxdeploy-plugin-gstreamer

Bundles GStreamer plugins into AppDirs. Experimental code, please expect issues! Help welcome!
3 stars 11 forks source link

Plugin does not work: bunch of gstreamer errors in console #8

Open akontsevich opened 2 years ago

akontsevich commented 2 years ago

Still gstreamer errors in console:

VideoReceiverLog: gst_element_factory_make() for data source failed
VideoReceiverLog: _makeSource() failed
VideoReceiverLog: Failed

In gstreamer log (GST_DEBUG=*:DEBUG,decodebin:LOG) seeing this error:

:180973): GLib-GObject-CRITICAL **: 13:34:25.780: g_object_set: assertion 'G_IS_OBJECT (object)' failed
0:00:04.257918723 180973 0x7f2c5c004380 DEBUG     GST_PLUGIN_LOADING gstpluginfeature.c:107:gst_plugin_feature_load: loading plugin for feature 0x55ac92f33c30; 'qgcvideosinkbin'
0:00:04.257925787 180973 0x7f2c5c004380 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:361:gst_element_factory_create: creating element "qgcvideosinkbin"
0:00:04.257934740 180973 0x7f2c5c004380 DEBUG                GST_BUS gstbus.c:232:gst_bus_init:<GstBus@0x7f2cb4016ed0> created
0:00:04.257941578 180973 0x7f2c5c004380 DEBUG                    bin gstbin.c:502:gst_bin_init:<GstBin@0x7f2c08012260> using bus <bus4209> to listen to children
0:00:04.257945282 180973 0x7f2c5c004380 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "glupload"!
0:00:04.257948762 180973 0x7f2c5c004380 ERROR        qgcvideosinkbin gstqgcvideosinkbin.c:122:_vsb_init:<GstQgcVideoSinkBin@0x7f2c08012260> gst_element_factory_make('glupload') failed
0:00:04.257953312 180973 0x7f2c5c004380 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:389:gst_element_factory_create: created element "qgcvideosinkbin"

May be some plugin is still missed and need to add with --library= switch?

TheAssassin commented 2 years ago

It is also possible that the plugins can just not be found properly. Is this the complete GStreamer log? I think there should be more log messages before those.

akontsevich commented 2 years ago

It is also possible that the plugins can just not be found properly. Is this the complete GStreamer log? I think there should be more log messages before those.

It is huge, do You want to attach it completely? The only error in the log is this mentioned above:

0:00:04.257948762 180973 0x7f2c5c004380 ERROR        qgcvideosinkbin gstqgcvideosinkbin.c:122:_vsb_init:<GstQgcVideoSinkBin@0x7f2c08012260> gst_element_factory_make('glupload') failed

I also guess Your plugin did not deploy some gstreamer plugins to the bundle as they were not installed in docker, so now I've installed them and rebuilding currently with such packages installed in build image:

      - gstreamer1.0-gl
      - libgstreamer1.0-0
      - libgstreamer-plugins-base1.0-0
      - libgstreamer-plugins-bad1.0-0
      - gstreamer1.0-x
      - gstreamer1.0-alsa
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-bad
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-pulseaudio
      - gstreamer1.0-libav
      - libavcodec57
      - libavfilter6
      - libavformat57
      - libavutil55
      - libx264-152
      - libx265-146
TheAssassin commented 2 years ago

The plugin just copies whatever is available on the system. At the moment, it cannot detect which plugins are really needed. Therefore, installing all plugins is a good idea.

PRs welcome that implement some detection.

akontsevich commented 2 years ago

The plugin just copies whatever is available on the system. At the moment, it cannot detect which plugins are really needed. Therefore, installing all plugins is a good idea.

PRs welcome that implement some detection.

I see.

So I installed all the plugins however have same error I got for appimage-builder:

0:00:00.000769905 413647 0x561ad97a0400 DEBUG     GST_PLUGIN_LOADING gstpluginloader.c:719:do_plugin_load: Plugin scanner loading file /tmp/.mount_MyAppaEWyHD/usr/lib/gstreamer-1.0/libgstx264.so. tag 0
0:00:02.960734521 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:980:gst_poll_fd_ctl_write: 0x55c63be52680: fd (fd:14, idx:1), active : 1
0:00:00.000774400 413647 0x561ad97a0400 DEBUG     GST_PLUGIN_LOADING gstplugin.c:760:_priv_gst_plugin_load_file_for_registry: attempt to load plugin "/tmp/.mount_MyAppaEWyHD/usr/lib/gstreamer-1.0/libgstx264.so"
0:00:02.960742288 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1317:gst_poll_wait: 0x55c63be52680: timeout :0:00:01.000000000
0:00:02.960750836 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1188:gst_poll_fd_has_error: 0x55c63be52680: fd (fd:15, idx:2) 0
0:00:02.960757943 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1213:gst_poll_fd_can_read_unlocked: 0x55c63be52680: fd (fd:15, idx:2) 0
0:00:02.960764653 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1142:gst_poll_fd_has_closed: 0x55c63be52680: fd (fd:15, idx:2) 0
0:00:02.960772636 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1188:gst_poll_fd_has_error: 0x55c63be52680: fd (fd:14, idx:1) 0
0:00:02.960779790 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1282:gst_poll_fd_can_write: 0x55c63be52680: fd (fd:14, idx:1) 1
0:00:02.960787636 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:980:gst_poll_fd_ctl_write: 0x55c63be52680: fd (fd:14, idx:1), active : 0
0:00:02.960796128 413413 0x7fcaf0004d60 DEBUG               GST_POLL gstpoll.c:1317:gst_poll_wait: 0x55c63be52680: timeout :0:00:01.000000000
0:00:00.002341526 413647 0x561ad97a0400 INFO                 x264enc gstx264enc.c:2956:plugin_init: linked against x264 build: 152
0:00:00.002363617 413647 0x561ad97a0400 ERROR                x264enc gstx264enc.c:163:load_x264: Failed to load '/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152'
0:00:00.002383431 413647 0x561ad97a0400 DEBUG       GST_ELEMENT_PADS gstelement.c:302:gst_element_base_class_init: type GstVideoEncoder : factory (nil)
0:00:00.002393276 413647 0x561ad97a0400 DEBUG       GST_ELEMENT_PADS gstelement.c:302:gst_element_base_class_init: type GstX264Enc : factory 0x561ad97c5a00
0:00:00.002450585 413647 0x561ad97a0400 INFO                 x264enc gstx264enc.c:227:gst_x264_enc_add_x264_chroma_format: 8-bit depth supported
0:00:00.002473968 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'framerate'
0:00:00.002479513 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'fraction'
0:00:00.002487030 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'width'
0:00:00.002489888 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'int'
0:00:00.002495601 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'height'
0:00:00.002498560 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'int'
0:00:00.002504759 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'stream-format'
0:00:00.002507701 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'string'
0:00:00.002511506 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'alignment'
0:00:00.002514263 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'string'
0:00:00.002517289 413647 0x561ad97a0400 DEBUG              structure gststructure.c:1964:gst_structure_parse_field: trying field name 'profile'
0:00:00.002520479 413647 0x561ad97a0400 DEBUG                default gstvalue.c:2548:_priv_gst_value_parse_value: trying type name 'string'
0:00:00.002545343 413647 0x561ad97a0400 DEBUG           GST_REGISTRY gstregistry.c:582:gst_registry_add_feature:<registry0> adding feature 0x561ad97c5a00 (x264enc)
0:00:00.002550811 413647 0x561ad97a0400 DEBUG        GST_REFCOUNTING gstobject.c:675:gst_object_set_parent:<x264enc> set parent (ref and sink)
0:00:00.002554692 413647 0x561ad97a0400 INFO      GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/tmp/.mount_MyAppaEWyHD/usr/lib/gstreamer-1.0/libgstx264.so" loaded
0:00:00.002558196 413647 0x561ad97a0400 DEBUG           GST_REGISTRY gstregistry.c:466:gst_registry_add_plugin:<registry0> adding plugin 0x561ad97c4190 for filename "/tmp/.mount_MyAppaEWyHD/usr/lib/gstreamer-1.0/libgstx264.so"
0:00:00.002563149 413647 0x561ad97a0400 DEBUG           GST_REGISTRY gstregistrychunks.c:253:gst_registry_chunks_save_feature:<x264enc> saved 1 interfaces 0 pad templates
0:00:00.002573271 413647 0x561ad97a0400 DEBUG           GST_REGISTRY gstregistrychunks.c:487:_priv_gst_registry_chunks_save_plugin: Found 1 features in plugin "x264"

See this line from the above:

0:00:00.002363617 413647 0x561ad97a0400 ERROR                x264enc gstx264enc.c:163:load_x264: Failed to load '/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152'

I see this file is not packaged to the bundle or packaged only /usr/lib/x86_64-linux-gnu/libx264.so.152. See libx264-152 package file list. I do not know if it causes the problem but video is not translated like in dev version. May be you need to preserve directory structure and package both files like in original package:

/usr/lib/x86_64-linux-gnu/libx264.so.152
/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152

?

x265 plugin loads and works fine according to the logs.

TheAssassin commented 2 years ago

Please try running ldd on the relevant gstreamer plugin and see whether the x265 libraries are linked directly.

akontsevich commented 2 years ago

Please try running ldd on the relevant gstreamer plugin and see whether the x265 libraries are linked directly.

Checking under Ubuntu 18.04 docker image:

ldd /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx265.so:

        linux-vdso.so.1 (0x00007ffc2d17d000)
        libgstvideo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 (0x00007fd1da829000)
        libgstpbutils-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0 (0x00007fd1da5f1000)
        libgstreamer-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 (0x00007fd1da2b6000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fd1da062000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fd1d9d4b000)
        libx265.so.146 => /usr/lib/x86_64-linux-gnu/libx265.so.146 (0x00007fd1d90ca000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd1d8cd9000)
        libgstbase-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 (0x00007fd1d8a64000)
        liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007fd1d87e8000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd1d844a000)
        libgstaudio-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0 (0x00007fd1d81d5000)
        libgsttag-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgsttag-1.0.so.0 (0x00007fd1d7f9a000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd1d7d7b000)
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fd1d7b77000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd1d796f000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd1d776b000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fd1d7563000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd1d72f1000)
        libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007fd1d70e6000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd1d6d5d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd1daccb000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd1d6b40000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd1d6928000)

ldd /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx264.so:

        linux-vdso.so.1 (0x00007fffe87da000)
        libgstvideo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 (0x00007f59c5606000)
        libgstpbutils-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0 (0x00007f59c53ce000)
        libgstreamer-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 (0x00007f59c5093000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f59c4e3f000)
        libx264.so.152 => /usr/lib/x86_64-linux-gnu/libx264.so.152 (0x00007f59c4a9a000)
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f59c4896000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f59c457f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f59c418e000)
        libgstbase-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 (0x00007f59c3f19000)
        liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007f59c3c9d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f59c38ff000)
        libgstaudio-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0 (0x00007f59c368a000)
        libgsttag-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgsttag-1.0.so.0 (0x00007f59c344f000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f59c3230000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f59c3028000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f59c2e24000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f59c2c1c000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f59c29aa000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f59c5aaf000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f59c278d000)
TheAssassin commented 2 years ago

Can you please rerun this on the x265 gstreamer plugin .so file that got deployed into your AppDir? libx265 seems to be linked directly. I suspect the library within the AppImage cannot be found by the deployed plugin, though.

akontsevich commented 2 years ago

Can you please rerun this on the x265 gstreamer plugin .so file that got deployed into your AppDir? libx265 seems to be linked directly. I suspect the library within the AppImage cannot be found by the deployed plugin, though.

Ok, but why do you need libx265 while problem is in libx264?

265:

squashfs-root/usr/lib/gstreamer-1.0$ ldd libgstx265.so 
        linux-vdso.so.1 (0x00007ffea615f000)
        libgstvideo-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstvideo-1.0.so.0 (0x00007fe1379e6000)
        libgstpbutils-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstpbutils-1.0.so.0 (0x00007fe1377aa000)
        libgstreamer-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstreamer-1.0.so.0 (0x00007fe137461000)
        libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fe1373d3000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe1372aa000)
        libx265.so.146 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libx265.so.146 (0x00007fe1365c2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe1363d0000)
        libgstbase-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstbase-1.0.so.0 (0x00007fe136156000)
        liborc-0.4.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../liborc-0.4.so.0 (0x00007fe135ed7000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe135d88000)
        libgstaudio-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstaudio-1.0.so.0 (0x00007fe135b0c000)
        libgsttag-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgsttag-1.0.so.0 (0x00007fe1358ce000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe1358ab000)
        libgmodule-2.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgmodule-2.0.so.0 (0x00007fe1356a6000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe13569b000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe135695000)
        libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007fe135687000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe135614000)
        libnuma.so.1 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libnuma.so.1 (0x00007fe135408000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe135226000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe137e92000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe13520a000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe1351ed000)

264:

squashfs-root/usr/lib/gstreamer-1.0$ ldd libgstx264.so 
        linux-vdso.so.1 (0x00007ffe7a517000)
        libgstvideo-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstvideo-1.0.so.0 (0x00007f4e97605000)
        libgstpbutils-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstpbutils-1.0.so.0 (0x00007f4e973c9000)
        libgstreamer-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstreamer-1.0.so.0 (0x00007f4e97080000)
        libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f4e96ff2000)
        libx264.so.152 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libx264.so.152 (0x00007f4e96c4a000)
        libgmodule-2.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgmodule-2.0.so.0 (0x00007f4e96a43000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f4e9691a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4e96728000)
        libgstbase-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstbase-1.0.so.0 (0x00007f4e964ae000)
        liborc-0.4.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../liborc-0.4.so.0 (0x00007f4e9622f000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4e960e0000)
        libgstaudio-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgstaudio-1.0.so.0 (0x00007f4e95e64000)
        libgsttag-1.0.so.0 => /home/aleksey/Work/AirMap/Code/AirBoss/squashfs-root/usr/lib/gstreamer-1.0/./../libgsttag-1.0.so.0 (0x00007f4e95c26000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4e95c03000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4e95bf8000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4e95bf2000)
        libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007f4e95be4000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f4e95b71000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4e97aba000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f4e95b55000)
TheAssassin commented 2 years ago

Ok, but why do you need libx265 while problem is in libx264?

My bad.

Would you mind to share your AppImage? In case it is open-source software, please provide a link to your repository and ideally to your build scripts.

akontsevich commented 2 years ago

It is a fork of QGroundControl, not open for now sorry. But I can give You build scripts of course: replace these lines master/deploy/create_linux_appimage.sh#L86-L93 with linuxdeploy script:

# now, build AppImage using linuxdeploy
# download linuxdeploy
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gstreamer/master/linuxdeploy-plugin-gstreamer.sh

# make them executable
chmod +x linuxdeploy*.AppImage
chmod +x linuxdeploy-plugin-gstreamer.sh

# copy all libs to the bundle
export LD_LIBRARY_PATH=${QGC_RELEASE_DIR}/libs:${QGC_RELEASE_DIR}/Qt/libs:$LD_LIBRARY_PATH

# run linuxdeploy and generate an AppDir
export APPIMAGE_EXTRACT_AND_RUN=1
./linuxdeploy-x86_64.AppImage --appdir ./$APP.AppDir --verbosity=1 \
    --desktop-file=./$APP.AppDir/qgroundcontrol.desktop \
    --icon-file=./$APP.AppDir/${QGC_CUSTOM_APP_ICON_NAME} \
    --executable=./$APP.AppDir/${QGC_CUSTOM_APP_NAME} \
    --library=/usr/lib/libgdal.so.20 --library=/usr/lib/libacpi.so.0 --library=/lib/x86_64-linux-gnu/libprocps.so.6 \
    --plugin gstreamer \
    --output appimage

cp ${TMPDIR}/*".AppImage" ${OUTPUT_DIR}/
rm -rf ${TMPDIR}

To run execute:

./deploy/create_linux_appimage.sh QGC_SRC_DIR QGC_RELEASE_DIR

where:

akontsevich commented 2 years ago

I also tried to add these switches to linuxdeploy:

    --library=/usr/lib/x86_64-linux-gnu/libx264.so.152 --library=/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152 \

However it did no helped: it deploys only 1 of it - libx264.so.152 - not sure from which dir and do not preserve dir structure which is the problem I think.

Copying files manually to the bundle did not help as well (appimage-builder also deploys both files correctly):

# copy missed libs to the bundle
export LD_LIBRARY_PATH=${QGC_RELEASE_DIR}/libs:${QGC_RELEASE_DIR}/Qt/libs:$LD_LIBRARY_PATH:$APP.AppDir/usr/lib/x86_64-linux-gnu:$APP.AppDir/usr/lib/x86_64-linux-gnu/x264-10bit
mkdir -p $APP.AppDir/usr/lib/x86_64-linux-gnu/x264-10bit
cp /usr/lib/x86_64-linux-gnu/libx264.so.152 $APP.AppDir/usr/lib/x86_64-linux-gnu/
cp /usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152 $APP.AppDir/usr/lib/x86_64-linux-gnu/x264-10bit/

Same error:

ERROR: x264enc gstx264enc.c:163:load_x264: Failed to load '/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152'

Strange libx264 package in Ubuntu 18.04 with 2 libx264.so.152 files, while 20.04 has only the one - libx264.so.155 and do not have such problems.

TheAssassin commented 2 years ago

That second library in x264-10bit is a very special case I have not seen before. I need to have a look myself at how these libraries are related. I suppose we need to implement some custom deployment there. Libraries are identified by name, and one should be able to assume that two libraries of the same name are compatible. This does not seem to be the case here.

From the name, I would have assumed that the 10-bit library just implements some 10-bit codec, but is not necessarily required...

akontsevich commented 2 years ago

That second library in x264-10bit is a very special case I have not seen before. I need to have a look myself at how these libraries are related. I suppose we need to implement some custom deployment there.

Yes, I thought the same. However solved for now by upgrading gstreamer to the latest stable version - 1.18.5 which has only 1 library file there in libx264-163.

From the name, I would have assumed that the 10-bit library just implements some 10-bit codec,

Guess the same.

but is not necessarily required...

I do not know, as You see GStreamer tried to load it in our app.

akontsevich commented 2 years ago

Video works for us now on some machines after gstreamer upgrade, on some not - they have another error:

0:00:00.001759367 119633 0x561a6817b400 DEBUG     GST_PLUGIN_LOADING gstpluginloader.c:722:do_plugin_load: Plugin scanner loading file /tmp/.mount_AirBoseuTTBr/usr/lib/gstreamer-1.0/libgstmsdk.so. tag 0
0:00:00.001770328 119633 0x561a6817b400 DEBUG     GST_PLUGIN_LOADING gstplugin.c:768:_priv_gst_plugin_load_file_for_registry: attempt to load plugin "/tmp/.mount_AirBoseuTTBr/usr/lib/gstreamer-1.0/libgstmsdk.so"
0:00:00.019396577 119633 0x561a6817b400 ERROR                   msdk msdk.c:203:msdk_open_session: Intel Media SDK not available (undeveloped feature)

I see that libmfx1 package is installed in our docker however only libmfx.so.1 library from it is deployed to AppImage bundle while it contains bunch of libraries:

/usr/lib/x86_64-linux-gnu/libmfx-tracer.so.1
/usr/lib/x86_64-linux-gnu/libmfx-tracer.so.1.35
/usr/lib/x86_64-linux-gnu/libmfx.so.1
/usr/lib/x86_64-linux-gnu/libmfx.so.1.35
/usr/lib/x86_64-linux-gnu/libmfxhw64.so.1
/usr/lib/x86_64-linux-gnu/libmfxhw64.so.1.35
/usr/lib/x86_64-linux-gnu/mfx/libmfx_h264la_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevc_fei_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevcd_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevce_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp8d_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp9d_hw64.so
/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp9e_hw64.so

Could You fix gstreamer plugin to deploy them as well please?

akontsevich commented 2 years ago

Latter is solved by putting Intel Media SDK libraries inside the bundle manually:

linuxdeploy \\\
    ...
    --library=/usr/lib/x86_64-linux-gnu/libmfx-tracer.so.1 \
    --library=/usr/lib/x86_64-linux-gnu/libmfx-tracer.so.1.35 \
    --library=/usr/lib/x86_64-linux-gnu/libmfx.so.1 \
    --library=/usr/lib/x86_64-linux-gnu/libmfx.so.1.35 \
    --library=/usr/lib/x86_64-linux-gnu/libmfxhw64.so.1 \
    --library=/usr/lib/x86_64-linux-gnu/libmfxhw64.so.1.35 \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_h264la_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevc_fei_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevcd_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_hevce_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp8d_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp9d_hw64.so \
    --library=/usr/lib/x86_64-linux-gnu/mfx/libmfx_vp9e_hw64.so \

So now video works everywhere!

akontsevich commented 2 years ago

Another error on Ubuntu Touchpad:

ERROR openni2src gstopenni2src.cpp:530:openni2_initialise_library: 
Initialization failed: 
Found no files matching '/usr/lib/OpenNI2/Drivers/lib*.so.

1st try:

To solve I'd also put above libraries manually like this:

    --library=/usr/lib/OpenNI2/Drivers/libDummyDevice.so.0 \
    --library=/usr/lib/OpenNI2/Drivers/libOniFile.so.0 \
    --library=/usr/lib/OpenNI2/Drivers/libPS1080.so.0 \
    --library=/usr/lib/OpenNI2/Drivers/libPSLink.so.0 \
    --library=/usr/lib/libOpenNI2.so.0 \

however got above error again. Seems GStreamer requires these paths to be preserved. Why linuxdeploy put them all into /usr/lib while some libs require exact paths?!

2nd try:

To solve tried to copy libs to the AppDir manually before linuxdeploy run:

# copy missed libs to the bundle
export LD_LIBRARY_PATH=${QGC_RELEASE_DIR}/libs:${QGC_RELEASE_DIR}/Qt/libs:$LD_LIBRARY_PATH
mkdir -p ${APPDIR}/usr/lib/OpenNI2/Drivers
cp /usr/lib/OpenNI2/Drivers/libDummyDevice.so.0 ${APPDIR}/usr/lib/OpenNI2/Drivers
cp /usr/lib/OpenNI2/Drivers/libOniFile.so.0 ${APPDIR}/usr/lib/OpenNI2/Drivers
cp /usr/lib/OpenNI2/Drivers/libPS1080.so.0 ${APPDIR}/usr/lib/OpenNI2/Drivers
cp /usr/lib/OpenNI2/Drivers/libPSLink.so.0 ${APPDIR}/usr/lib/OpenNI2/Drivers

# run linuxdeploy and generate an AppDir
./linuxdeploy-x86_64.AppImage --appdir ./$APP.AppDir --verbosity=1 \
    ...
    --library=/usr/lib/libOpenNI2.so.0 \
    ...

However above does not work as well, same error:

ERROR openni2src gstopenni2src.cpp:530:openni2_initialise_library: 
Initialization failed:  
Found no files matching '/usr/lib/OpenNI2/Drivers/lib*.so.

Any ideas how to solve? Seems same problem as with x264 10-bit library error: it tries to load files from /usr/lib/..., not from AppImage ./tmpDir/usr/lib/.... What to do with such cases?


So I think there is a lot to polish in linuxdeploy and its gstreamer plugin.

TheAssassin commented 2 years ago

So I think there is a lot to polish in linuxdeploy and its gstreamer plugin.

Feel free to contribute. I'm trying to help here. You have not yet provided an example project that I could test changes against. I do not have time to set up my own environment from the few information you provided so far and fiddle until I have an environment that is similar to yours so I can reproduce these issues. Also, now there are more cases added to this issue. Please open a new issue about your driver stuff.

You're doing some very special stuff that has never been required before. This plugin is also relatively new and doesn't have sophisticated deployments for everything. It needs some love.

I have some time next week that I want to dedicate to linuxdeploy and this plugin. How far has your project deviated from standard QGroundControl? I assume your build scripts can be shared or adapted at least to exclude problematic parts (otherwise helping would be difficult anyway), so we could create a fork of QGroundControl, you could integrate your scripts and I can then try to reproduce these issues myself.

Why linuxdeploy put them all into /usr/lib while some libs require exact paths?!

Copying them into one directory is the default behavior of linuxdeploy. In the vast majority of all deployments, the libraries can live just fine in a singular directory. In fact, this is the case for the majority of all libraries on any distributions. Distros may add an architecture triplet component to the path, but in single-architecture AppImages, this is not needed, thus that path is exclued.

Plugin systems etc. are not supported directly by linuxdeploy, i.e., -l should not be used with them. The docs should arguably be clearer on this topic. This is what linuxdeploy's plugins are there for: deploy such plugin libraries in a way that works.

"Exact paths", or rather hardcoded paths, are a bad misconception and an antipattern that used to dominate build systems and distributions as well. They effectively prevent relocation, a property needed for AppImages to work. See also https://docs.appimage.org/reference/best-practices.html#binaries-must-not-use-compiled-in-absolute-paths. The reason to use hardcoded paths is to reduce the need for path calculations within applications: you just expect resources to be at a specific path. In most modern frameworks (e.g., Qt), one can locate resources during runtime by resolving paths relative to known locations, typically relative to the main binary.

This kind of relocatability is implemented by linuxdeploy to make sure the linker can find shared libraries during runtime using relative paths. We set the rpath (a.k.a. DT_RUNPATH) to $ORIGIN/../lib. In a typical AppDir, where the main binary is in .../<AppDir>/usr/bin/<myapp> the $ORIGIN path points to this usr/bin directory. The linker will now look for libraries in .../<AppDir>/usr/bin/../lib/, which resolves to .../<AppDir>/usr/lib.

In case some plugins/drivers/whatever you need hardcode paths, they are not relocatable and deploying them in an AppImage will be a challenge. We might have to set environment variables etc. to help GStreamer etc. find them (in fact, we already use some environment variables for this). Note that environment variables induce new issues. But one step after another.


For the record: deploying any kind of driver in AppImages is highly discouraged. Hardware-dependent libraries typically require said hardware to be in place. Obviously this is going to lead to new issues on other hardware which does not provide said requirements.

You see, there is some complexity. Please open a new issue about your driver stuff.

akontsevich commented 2 years ago

You have not yet provided an example project that I could test changes against.

I did! Read above comments: https://github.com/linuxdeploy/linuxdeploy-plugin-gstreamer/issues/8#issuecomment-978888119 - QGroundControl + drone simulator is enough for testing.

PX4 sim to run: https://docs.px4.io/master/en/simulation/gazebo.html#running-the-simulation

I have some time next week that I want to dedicate to linuxdeploy and this plugin. How far has your project deviated from standard QGroundControl?

Regarding this functionality: transfer video from drone to QGroundControl - code is the same - was not changed, so You may use pure QGroundControl for this. However problems differ for our machines:

Was able to fix the latter as well - found the solution here: https://stackoverflow.com/a/29693295/630169.

so we could create a fork of QGroundControl, you could integrate your scripts

Yes, we can do of course, that is easy, however like I said just need to replace few lines in master/deploy/create_linux_appimage.sh#L86-L93 file. :point_up:

and I can then try to reproduce these issues myself.

Thanks!

For the record: deploying any kind of driver in AppImages is highly discouraged.

Of course, but libgstopenni2.so gstreamer lib is built and linked directly against libOpenNI2.so.0 library and it does contain /usr/lib/OpenNI2/Drivers/lib*.so drivers within its package. So I think this should be shipped with the AppImage as even if client installs these driver there could be situation they won't work because of different glibc, gcc compiler version, Linux distributions, etc.

TheAssassin commented 2 years ago

Can you please fork QGroundControl, make the changes and post a link?

akontsevich commented 2 years ago

Can you please fork QGroundControl, make the changes and post a link?

Sure. Like I mentioned above we were able to fix all the issues, however I think You may use them of course to polish linuxdeploy gstreamer plugin: https://github.com/airmap/qgroundcontrol/pull/13/files

Latest GStreamer from PPA could be necessary there as well: https://askubuntu.com/q/1377561/130585

Original QGroundControl.AppImage does not have GStreamer libraries within and works on Ubuntu 20.04 just utilizing system GStreamer, and does not work on 18.04. Our AppImage works on both.

To test simulator is necessary: https://github.com/PX4/PX4-Autopilot Instructions to run it: https://docs.px4.io/master/en/simulation/gazebo.html#running-the-simulation