Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display

Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display

Scheduled Pinned Locked Moved Solved Mobile and Embedded
6 Posts 3 Posters 5.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    glamis
    wrote on 11 Aug 2020, 19:59 last edited by
    #1

    I have successfully cross-compiled Qt5.15.0 with HW accelerated OpenGL (eglfs) so that Qt apps can run without x11. I know that I was able to cross-compile and install qt5.15.0 successfully on pi0 because I am able to cross-compile and deploy remotely non GUI application from QtCreator.

    However when I run GUI application (for example qopenglwidget example project that comes with qt source code), I get the following error:

    qt.qpa.screen: QXcbConnection: Could not connect to display 
    Could not connect to any X display.
    

    As the application compiled without any error I assume that the problem comes error while linking to some dynamic library. Has any had similar issues and does anyone know how to fix this ? The following observation may be useful for answering my query

    • After installing qt5 library I have updated ldconfig by running:
    echo /usr/local/qt5pi/lib | sudo tee /etc/ld.so.conf.d/qt5pi.conf
    sudo ldconfig
    
    • When configuring Qt5 for install I had put the option -opengl option and I had obtained the following options (only relevant ones shown here) :
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    
    EGLFS .................................. yes
      EGLFS Raspberry Pi ................... yes
    
    X11 specific:
      XLib ................................. no
      XCB Xlib ............................. no
      EGL on X11 ........................... no
      xkbcommon-x11 ........................ no
    
    • Raspberry Pi zero W is running : Raspbian Buster (Linux kernel 5.
    1 Reply Last reply
    0
    • S sierdzio
      11 Aug 2020, 20:23

      @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

      How can I force it to use my version of Qt5 ?

      Set the LD path before running (does not require recompilation):

      export LD_LIBRARY_PATH=/path/to/your/qt
      ./yourAppBinary
      

      Or you can link with rpath (does require recompilation).

      G Offline
      G Offline
      glamis
      wrote on 11 Aug 2020, 20:48 last edited by
      #5

      @sierdzio said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

      @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

      How can I force it to use my version of Qt5 ?

      Set the LD path before running (does not require recompilation):

      export LD_LIBRARY_PATH=/path/to/your/qt
      ./yourAppBinary
      

      Or you can link with rpath (does require recompilation).

      Thanks for the suggestion. Modifying LD_LIBRARY_PATH did indeed work. Addiotionaly I had to add the currect user to video group (and login/logout to apply changes):

      usermod -aG video $USER
      

      I will recompile with -rpath option to fix this issue permanently.

      P 1 Reply Last reply 12 Aug 2020, 00:31
      0
      • S Offline
        S Offline
        sierdzio
        Moderators
        wrote on 11 Aug 2020, 20:10 last edited by
        #2
        • are you running with your Qt or the one built-into Raspbian (check with ldd)
        • you can force correct platform plugin using command line switch: ./yourAppBinary -platform eglfs

        (Z(:^

        G 1 Reply Last reply 11 Aug 2020, 20:20
        0
        • S sierdzio
          11 Aug 2020, 20:10
          • are you running with your Qt or the one built-into Raspbian (check with ldd)
          • you can force correct platform plugin using command line switch: ./yourAppBinary -platform eglfs
          G Offline
          G Offline
          glamis
          wrote on 11 Aug 2020, 20:20 last edited by
          #3

          @sierdzio said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

          ldd

          Thanks for the suggestion. Indeed the application is using the built-in qt5 and not rhe one I used:

          dietpi@pifotoframe:~$ ldd qopenglwidget 
          	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so (0xb6f95000)
          	libQt5Widgets.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5 (0xb6a39000)
          	libQt5Gui.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 (0xb65b9000)
          	libQt5Core.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb613f000)
          	libGLESv2.so => /opt/vc/lib/libGLESv2.so (0xb611a000)
          	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb60f0000)
          	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb5fa9000)
          	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb5f27000)
          	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb5efa000)
          	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb5dac000)
          	/lib/ld-linux-armhf.so.3 (0xb6fa8000)
          	libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb5d70000)
          	libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0xb5c72000)
          	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb5c47000)
          	libatomic.so.1 => /usr/lib/arm-linux-gnueabihf/libatomic.so.1 (0xb5c2e000)
          	libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb59e0000)
          	libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb585a000)
          	libpcre2-16.so.0 => /usr/lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb57de000)
          	libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb57ba000)
          	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb57a7000)
          	libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5697000)
          	libEGL.so => /opt/vc/lib/libEGL.so (0xb565e000)
          	libbcm_host.so => /opt/vc/lib/libbcm_host.so (0xb5634000)
          	libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0xb561e000)
          	libvcos.so => /opt/vc/lib/libvcos.so (0xb5605000)
          	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb55ee000)
          	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb554b000)
          	libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0xb551a000)
          	libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0xb3b1c000)
          	libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb3aa5000)
          

          How can I force it to use my version of Qt5 ?

          I have already tried

          ./yourAppBinary -platform eglfs
          

          But I'm getting the following error :

          dietpi@pifotoframe:~$ ./qopenglwidget -platform eglfs
          Could not open display
          Aborted
          
          S 1 Reply Last reply 11 Aug 2020, 20:23
          0
          • G glamis
            11 Aug 2020, 20:20

            @sierdzio said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

            ldd

            Thanks for the suggestion. Indeed the application is using the built-in qt5 and not rhe one I used:

            dietpi@pifotoframe:~$ ldd qopenglwidget 
            	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so (0xb6f95000)
            	libQt5Widgets.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5 (0xb6a39000)
            	libQt5Gui.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5 (0xb65b9000)
            	libQt5Core.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb613f000)
            	libGLESv2.so => /opt/vc/lib/libGLESv2.so (0xb611a000)
            	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb60f0000)
            	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb5fa9000)
            	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb5f27000)
            	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb5efa000)
            	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb5dac000)
            	/lib/ld-linux-armhf.so.3 (0xb6fa8000)
            	libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb5d70000)
            	libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0xb5c72000)
            	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb5c47000)
            	libatomic.so.1 => /usr/lib/arm-linux-gnueabihf/libatomic.so.1 (0xb5c2e000)
            	libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb59e0000)
            	libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb585a000)
            	libpcre2-16.so.0 => /usr/lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb57de000)
            	libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb57ba000)
            	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb57a7000)
            	libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5697000)
            	libEGL.so => /opt/vc/lib/libEGL.so (0xb565e000)
            	libbcm_host.so => /opt/vc/lib/libbcm_host.so (0xb5634000)
            	libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0xb561e000)
            	libvcos.so => /opt/vc/lib/libvcos.so (0xb5605000)
            	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb55ee000)
            	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb554b000)
            	libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0xb551a000)
            	libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0xb3b1c000)
            	libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb3aa5000)
            

            How can I force it to use my version of Qt5 ?

            I have already tried

            ./yourAppBinary -platform eglfs
            

            But I'm getting the following error :

            dietpi@pifotoframe:~$ ./qopenglwidget -platform eglfs
            Could not open display
            Aborted
            
            S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 11 Aug 2020, 20:23 last edited by
            #4

            @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

            How can I force it to use my version of Qt5 ?

            Set the LD path before running (does not require recompilation):

            export LD_LIBRARY_PATH=/path/to/your/qt
            ./yourAppBinary
            

            Or you can link with rpath (does require recompilation).

            (Z(:^

            G 1 Reply Last reply 11 Aug 2020, 20:48
            0
            • S sierdzio
              11 Aug 2020, 20:23

              @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

              How can I force it to use my version of Qt5 ?

              Set the LD path before running (does not require recompilation):

              export LD_LIBRARY_PATH=/path/to/your/qt
              ./yourAppBinary
              

              Or you can link with rpath (does require recompilation).

              G Offline
              G Offline
              glamis
              wrote on 11 Aug 2020, 20:48 last edited by
              #5

              @sierdzio said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

              @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

              How can I force it to use my version of Qt5 ?

              Set the LD path before running (does not require recompilation):

              export LD_LIBRARY_PATH=/path/to/your/qt
              ./yourAppBinary
              

              Or you can link with rpath (does require recompilation).

              Thanks for the suggestion. Modifying LD_LIBRARY_PATH did indeed work. Addiotionaly I had to add the currect user to video group (and login/logout to apply changes):

              usermod -aG video $USER
              

              I will recompile with -rpath option to fix this issue permanently.

              P 1 Reply Last reply 12 Aug 2020, 00:31
              0
              • G glamis
                11 Aug 2020, 20:48

                @sierdzio said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

                @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

                How can I force it to use my version of Qt5 ?

                Set the LD path before running (does not require recompilation):

                export LD_LIBRARY_PATH=/path/to/your/qt
                ./yourAppBinary
                

                Or you can link with rpath (does require recompilation).

                Thanks for the suggestion. Modifying LD_LIBRARY_PATH did indeed work. Addiotionaly I had to add the currect user to video group (and login/logout to apply changes):

                usermod -aG video $USER
                

                I will recompile with -rpath option to fix this issue permanently.

                P Offline
                P Offline
                Pablo J. Rogina
                wrote on 12 Aug 2020, 00:31 last edited by
                #6

                @glamis said in Qt5 with OpenGL (on Raspberry Pi 0) getting error QXcbConnection: Could not connect to display Could not connect to any X display:

                did indeed work

                great, please don't forget to mark your post as solved!

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0

                1/6

                11 Aug 2020, 19:59

                • Login

                • Login or register to search.
                1 out of 6
                • First post
                  1/6
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved