Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Pi 4 - QT 5 with Open CV 4.1 App - No GUI Display - Problem with GTK



  • Hi,

    I've got an app that runs fine when I run it from sudo. When I dont run it from sudo (when developing/debugging on QtCreator), no GUI appears, and I get the following errors :

    (tryme:21572): GLib-GObject-WARNING **: 07:12:03.833: cannot register existing type 'GtkWidget'

    (tryme:21572): GLib-GObject-CRITICAL **: 07:12:03.834: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

    (tryme:21572): GLib-GObject-WARNING **: 07:12:03.834: cannot register existing type 'GtkBuildable'

    (tryme:21572): GLib-GObject-CRITICAL **: 07:12:03.834: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

    (tryme:21572): GLib-CRITICAL **: 07:12:03.834: g_once_init_leave: assertion 'result != 0' failed

    (tryme:21572): GLib-GObject-CRITICAL **: 07:12:03.834: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

    (tryme:21572): GLib-GObject-CRITICAL **: 07:12:03.834: g_type_register_static: assertion 'parent_type > 0' failed

    All of my QT apps work fine, but as soon as I add opencv lib to the .pro and build and run (with no code changes), the GUI doesnt appear.

    I add this to my .pro, run qmake, build and run :

    LIBS += -L/usr/local/lib -lopencv_world

    When I run the app and pause it the stack on Thread #1 :

    syscall
    g_cond_wait
    g_once_init_enter
    gtb_buildable_get_type
    gtb_container_get_type

    ldd on the APP :

    ldd JustQT
    linux-vdso.so.1 (0xbec1d000)
    /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f93000)
    libopencv_world.so.4.1 => /usr/local/lib/libopencv_world.so.4.1 (0xb51cb000)
    libQt5Widgets.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5 (0xb4c63000)
    libQt5Gui.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 (0xb47e3000)
    libQt5Core.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb4369000)
    libGLESv2.so.2 => /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 (0xb434a000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb4320000)
    libatomic.so.1 => /usr/lib/arm-linux-gnueabihf/libatomic.so.1 (0xb4307000)
    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb41c0000)
    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb413e000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb4111000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb3fc3000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb3fb0000)
    librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb3f99000)
    libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb3f6e000)
    libjpeg.so.62 => /usr/lib/arm-linux-gnueabihf/libjpeg.so.62 (0xb3f29000)
    libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb3eed000)
    libtiff.so.5 => /usr/lib/arm-linux-gnueabihf/libtiff.so.5 (0xb3e6d000)
    libjasper.so.1 => /usr/lib/arm-linux-gnueabihf/libjasper.so.1 (0xb3e11000)
    libgtk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgtk-3.so.0 (0xb37fb000)
    libgdk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk-3.so.0 (0xb3723000)
    libpangocairo-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpangocairo-1.0.so.0 (0xb3708000)
    libpango-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 (0xb36bb000)
    libatk-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 (0xb368d000)
    libcairo-gobject.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo-gobject.so.2 (0xb3676000)
    libcairo.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo.so.2 (0xb357d000)
    libgdk_pixbuf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0 (0xb354b000)
    libgio-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 (0xb33cf000)
    libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb3372000)
    libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb3262000)
    libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb3250000)
    libhdf5_serial.so.103 => /usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.103 (0xb2e54000)
    libsz.so.2 => /usr/lib/arm-linux-gnueabihf/libsz.so.2 (0xb2e41000)
    libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb2d9e000)
    libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0xb2ca0000)
    libavcodec.so.58 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libavcodec.so.58 (0xb1925000)
    libavformat.so.58 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libavformat.so.58 (0xb16fc000)
    libavutil.so.56 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libavutil.so.56 (0xb1673000)
    libswscale.so.5 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libswscale.so.5 (0xb15f8000)
    /lib/ld-linux-armhf.so.3 (0xb6fa8000)
    libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb13aa000)
    libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb1224000)
    libpcre2-16.so.0 => /usr/lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb11a8000)
    libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb1184000)
    libGLdispatch.so.0 => /usr/lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0xb1105000)
    libwebp.so.6 => /usr/lib/arm-linux-gnueabihf/libwebp.so.6 (0xb10a1000)
    libzstd.so.1 => /usr/lib/arm-linux-gnueabihf/libzstd.so.1 (0xb1008000)
    liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0xb0fd7000)
    libjbig.so.0 => /usr/lib/arm-linux-gnueabihf/libjbig.so.0 (0xb0fba000)
    libgmodule-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgmodule-2.0.so.0 (0xb0fa6000)
    libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb0e84000)
    libXi.so.6 => /usr/lib/arm-linux-gnueabihf/libXi.so.6 (0xb0e66000)
    libXcomposite.so.1 => /usr/lib/arm-linux-gnueabihf/libXcomposite.so.1 (0xb0e53000)
    libXdamage.so.1 => /usr/lib/arm-linux-gnueabihf/libXdamage.so.1 (0xb0e40000)
    libXfixes.so.3 => /usr/lib/arm-linux-gnueabihf/libXfixes.so.3 (0xb0e2b000)
    libatk-bridge-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-bridge-2.0.so.0 (0xb0df2000)
    libxkbcommon.so.0 => /usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0 (0xb0da9000)
    libwayland-cursor.so.0 => /usr/lib/arm-linux-gnueabihf/libwayland-cursor.so.0 (0xb0d92000)
    libwayland-egl.so.1 => /usr/lib/arm-linux-gnueabihf/libwayland-egl.so.1 (0xb0d80000)
    libwayland-client.so.0 => /usr/lib/arm-linux-gnueabihf/libwayland-client.so.0 (0xb0d66000)
    libepoxy.so.0 => /usr/lib/arm-linux-gnueabihf/libepoxy.so.0 (0xb0c70000)
    libpangoft2-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpangoft2-1.0.so.0 (0xb0c4e000)
    libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb0c06000)
    libXinerama.so.1 => /usr/lib/arm-linux-gnueabihf/libXinerama.so.1 (0xb0bf3000)
    libXrandr.so.2 => /usr/lib/arm-linux-gnueabihf/libXrandr.so.2 (0xb0bda000)
    libXcursor.so.1 => /usr/lib/arm-linux-gnueabihf/libXcursor.so.1 (0xb0bc1000)
    libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb0ba2000)
    libthai.so.0 => /usr/lib/arm-linux-gnueabihf/libthai.so.0 (0xb0b8a000)
    libfribidi.so.0 => /usr/lib/arm-linux-gnueabihf/libfribidi.so.0 (0xb0b60000)
    libpixman-1.so.0 => /usr/lib/arm-linux-gnueabihf/libpixman-1.so.0 (0xb0a85000)
    libxcb-shm.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-shm.so.0 (0xb0a72000)
    libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb0a43000)
    libxcb-render.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-render.so.0 (0xb0a28000)
    libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0xb0a0f000)
    libmount.so.1 => /lib/arm-linux-gnueabihf/libmount.so.1 (0xb09ae000)
    libselinux.so.1 => /lib/arm-linux-gnueabihf/libselinux.so.1 (0xb097c000)
    libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0xb0958000)
    libffi.so.6 => /usr/lib/arm-linux-gnueabihf/libffi.so.6 (0xb0940000)
    libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb08c9000)
    libaec.so.0 => /usr/lib/arm-linux-gnueabihf/libaec.so.0 (0xb08b1000)
    libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0xb0880000)
    libswresample.so.3 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libswresample.so.3 (0xb085a000)
    libvpx.so.5 => /usr/lib/arm-linux-gnueabihf/libvpx.so.5 (0xb0757000)
    libwebpmux.so.3 => /usr/lib/arm-linux-gnueabihf/libwebpmux.so.3 (0xb073d000)
    libmmal_core.so => /opt/vc/lib/libmmal_core.so (0xb071f000)
    libmmal_util.so => /opt/vc/lib/libmmal_util.so (0xb06ff000)
    libmmal_vc_client.so => /opt/vc/lib/libmmal_vc_client.so (0xb06e4000)
    libbcm_host.so => /opt/vc/lib/libbcm_host.so (0xb06ba000)
    libvcsm.so => /opt/vc/lib/libvcsm.so (0xb06a0000)
    librsvg-2.so.2 => /usr/lib/arm-linux-gnueabihf/librsvg-2.so.2 (0xb0292000)
    libzvbi.so.0 => /usr/lib/arm-linux-gnueabihf/libzvbi.so.0 (0xb020f000)
    libsnappy.so.1 => /usr/lib/arm-linux-gnueabihf/libsnappy.so.1 (0xb01f8000)
    libaom.so.0 => /usr/lib/arm-linux-gnueabihf/libaom.so.0 (0xafefc000)
    libcodec2.so.0.8.1 => /usr/lib/arm-linux-gnueabihf/libcodec2.so.0.8.1 (0xafe93000)
    libgsm.so.1 => /usr/lib/arm-linux-gnueabihf/libgsm.so.1 (0xafe76000)
    libmp3lame.so.0 => /usr/lib/arm-linux-gnueabihf/libmp3lame.so.0 (0xafdfa000)
    libopenjp2.so.7 => /usr/lib/arm-linux-gnueabihf/libopenjp2.so.7 (0xafd9f000)
    libopus.so.0 => /usr/lib/arm-linux-gnueabihf/libopus.so.0 (0xafd40000)
    libshine.so.3 => /usr/lib/arm-linux-gnueabihf/libshine.so.3 (0xafd26000)
    libspeex.so.1 => /usr/lib/arm-linux-gnueabihf/libspeex.so.1 (0xafcff000)
    libtheoraenc.so.1 => /usr/lib/arm-linux-gnueabihf/libtheoraenc.so.1 (0xafcbe000)
    libtheoradec.so.1 => /usr/lib/arm-linux-gnueabihf/libtheoradec.so.1 (0xafc96000)
    libtwolame.so.0 => /usr/lib/arm-linux-gnueabihf/libtwolame.so.0 (0xafc66000)
    libvorbis.so.0 => /usr/lib/arm-linux-gnueabihf/libvorbis.so.0 (0xafc2f000)
    libvorbisenc.so.2 => /usr/lib/arm-linux-gnueabihf/libvorbisenc.so.2 (0xafb9d000)
    libwavpack.so.1 => /usr/lib/arm-linux-gnueabihf/libwavpack.so.1 (0xafb67000)
    libx264.so.155 => /usr/lib/arm-linux-gnueabihf/neon/vfp/libx264.so.155 (0xaf91b000)
    libx265.so.165 => /usr/lib/arm-linux-gnueabihf/libx265.so.165 (0xaf661000)
    libxvidcore.so.4 => /usr/lib/arm-linux-gnueabihf/libxvidcore.so.4 (0xaf571000)
    libva.so.2 => /usr/lib/arm-linux-gnueabihf/libva.so.2 (0xaf542000)
    libxml2.so.2 => /usr/lib/arm-linux-gnueabihf/libxml2.so.2 (0xaf3c5000)
    libbz2.so.1.0 => /lib/arm-linux-gnueabihf/libbz2.so.1.0 (0xaf3a5000)
    libgme.so.0 => /usr/lib/arm-linux-gnueabihf/libgme.so.0 (0xaf357000)
    libopenmpt.so.0 => /usr/lib/arm-linux-gnueabihf/libopenmpt.so.0 (0xaf199000)
    cut for brevity

    I looked at each of the libs to see if there are any conflicts :

    linux-vdso.so.1 (0xbee8b000)
    /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb517f000)
    libatomic.so.1 => /usr/lib/arm-linux-gnueabihf/libatomic.so.1 (0xb514b000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb5138000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb510e000)
    librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb50f7000)
    libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb50cc000)
    libjpeg.so.62 => /usr/lib/arm-linux-gnueabihf/libjpeg.so.62 (0xb5087000)
    libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb504b000)
    libtiff.so.5 => /usr/lib/arm-linux-gnueabihf/libtiff.so.5 (0xb4fcb000)
    libjasper.so.1 => /usr/lib/arm-linux-gnueabihf/libjasper.so.1 (0xb4f6f000)
    libgtk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgtk-3.so.0 (0xb4959000)
    libgdk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk-3.so.0 (0xb4881000)
    libpangocairo-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpangocairo-1.0.so.0 (0xb4866000)
    libpango-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 (0xb4819000)
    libatk-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 (0xb47eb000)
    libcairo-gobject.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo-gobject.so.2 (0xb47d4000)
    libcairo.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo.so.2 (0xb46db000)
    libgdk_pixbuf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0 (0xb46a9000)
    libgio-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 (0xb452d000)
    libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb44d0000)
    libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb43c0000)
    libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb43ae000)
    libhdf5_serial.so.103 => /usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.103 (0xb3fb2000)
    libsz.so.2 => /usr/lib/arm-linux-gnueabihf/libsz.so.2 (0xb3f9f000)
    cut for brevity

    And QT 5 Gui lib

    /QTExamples/build-JustQT-Desktop-Debug $ ldd /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 | more
    linux-vdso.so.1 (0xbedc4000)
    /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6ac0000)
    libQt5Core.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb662b000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6601000)
    libGLESv2.so.2 => /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 (0xb65e2000)
    libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb65a6000)
    libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0xb64a8000)
    libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb647d000)
    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6336000)
    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb62b4000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6287000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6139000)
    /lib/ld-linux-armhf.so.3 (0xb6f55000)
    libatomic.so.1 => /usr/lib/arm-linux-gnueabihf/libatomic.so.1 (0xb6120000)
    libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb5ed2000)
    libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb5d4c000)
    libpcre2-16.so.0 => /usr/lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb5cd0000)
    libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb5cac000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb5c99000)
    libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5b89000)
    libGLdispatch.so.0 => /usr/lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0xb5b0a000)
    libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb5a67000)
    libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0xb5a36000)
    libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0xb4038000)
    libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb3fc1000)



  • I have found the issue. There is a env var that sets the QT Style, and it was using gtk2. As can be seen from my lib dependencies, my app is linking in and using gtk3, so I changed the env var, and it works !

    I thought about putting them in the environment folder (under etc), but for now I've put them in my .bashrc

    export QT_QPA_PLATFORMTHEME=gtk3
    export QT_STYLE_OVERRIDE=gtk3

    Thanks
    Marcus


Log in to reply