Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Static Compile Linux - Error Loading libxcb-xinerama.so
QtWS25 Last Chance

Qt Static Compile Linux - Error Loading libxcb-xinerama.so

Scheduled Pinned Locked Moved Solved General and Desktop
linuxstatic buildg++
14 Posts 6 Posters 10.5k 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.
  • S Offline
    S Offline
    ScottLupton
    wrote on 1 Feb 2017, 05:02 last edited by
    #1

    I built Qt for static compilation on Ubuntu using the configuration:

    ./configure -static -platform linux-g++-64 -prefix /home/scott/Qt5.7.0 -opensource -make libs
    

    I then built a statically compiled Qt application, but when I run the application on a clean Ubuntu Linux installation I get the error:

    error while loading shared libraries: libxcb-xinerama.so
    

    Is there a way to build my Qt application so that this library will be statically compiled into the executable?

    J 1 Reply Last reply 1 Feb 2017, 05:17
    0
    • S ScottLupton
      1 Feb 2017, 05:02

      I built Qt for static compilation on Ubuntu using the configuration:

      ./configure -static -platform linux-g++-64 -prefix /home/scott/Qt5.7.0 -opensource -make libs
      

      I then built a statically compiled Qt application, but when I run the application on a clean Ubuntu Linux installation I get the error:

      error while loading shared libraries: libxcb-xinerama.so
      

      Is there a way to build my Qt application so that this library will be statically compiled into the executable?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 1 Feb 2017, 05:17 last edited by
      #2

      @ScottLupton You would need a static version of this library and libraries this one needs

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        ScottLupton
        wrote on 1 Feb 2017, 12:39 last edited by ScottLupton 2 Jun 2017, 15:50
        #3

        I don't usually use Linux so I'm having trouble finding what I need to install to get the static version.

        I installed installed the libxcb-xinerama packages and some other xinerama packages I found search the repository:

        libxcb-xinerama0 
        libxcb-xinerama0-dev
        libxinerama1
        libxinerama-dev
        

        Unfortunately that didn't solve the problem.

        Looking at the output from configure I noticed some libraries were set to load at runtime:

        XCB .................. yes (system library)
          EGL on X ........... no
          GLX ................ yes
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes (loaded at runtime)
          Xfixes ............. yes (loaded at runtime)
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes
          Xrandr ............. yes (loaded at runtime)
          Xrender ............ yes
          XKB ................ no
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
        

        I therefore added -xrandr -xcursor -xfixes parameters to configure, after which it changed to:

        XCB .................. yes (system library)
          EGL on X ........... no
          GLX ................ yes
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes
          Xfixes ............. yes
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes (loaded at runtime)
          Xrandr ............. yes
          Xrender ............ yes
          XKB ................ no
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
        

        I then ran configure again also adding -xnerama, after which I got:

        XCB .................. yes (system library)
          EGL on X ........... no
          GLX ................ yes
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes
          Xfixes ............. yes
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes
          Xrandr ............. yes
          Xrender ............ yes
          XKB ................ no
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
        

        I thought that would be the solution, but after rebuilding Qt and my application I still get: error while loading shared libraries: libxcb-xinerama.so

        I also tried adding this to the project's .pro file:

        SLIBS += /usr/lib/x86_64-linux-gnu/libxcb-xinerama.a
        

        But that also didn't solve the problem.

        How do I statically compile the xcb-xinerama library?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          ScottLupton
          wrote on 6 Feb 2017, 15:59 last edited by
          #4

          I've been trying to statically compile my application on Linux for a week, but I'm still no closer to a solution.

          Getting nothing done for a week has been a real nightmare. I think it's time to move on from the hard liqueur and hit the crack cocaine :)

          If anyone can point me in the right general direction I'd be grateful.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 6 Feb 2017, 22:03 last edited by
            #5

            Hi and welcome to devnet,

            IIRC, when presented with both option the linker uses the shared library. Note that if you don't need Xinerama support for your application you can also disable the option.

            Also, don't forget the implication about using a static build of Qt.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            S D 2 Replies Last reply 7 Feb 2017, 01:33
            1
            • S SGaist
              6 Feb 2017, 22:03

              Hi and welcome to devnet,

              IIRC, when presented with both option the linker uses the shared library. Note that if you don't need Xinerama support for your application you can also disable the option.

              Also, don't forget the implication about using a static build of Qt.

              S Offline
              S Offline
              ScottLupton
              wrote on 7 Feb 2017, 01:33 last edited by
              #6

              @SGaist said in Qt Static Compile Linux - Error Loading libxcb-xinerama.so:

              Note that if you don't need Xinerama support for your application you can also disable the option.

              Thanks for the suggestion. I ran configure with -no-xinerama and checked the output to confirm it was disabled:

              Xinerama ........... no
              

              I then built Qt and built my application, but it still said "error while loading shared libraries: libxcb-xinerama.so"

              I just tried another solution, which was to run configure with -qt-xcb so it uses the xcb libraries bundled with Qt, and that finally solved the problem. It's very late now so I'll read about -qt-xcb more when I got up tomorrow.

              Before I mark this as solved I best ask, are there any possible issues with using -qt-xcb?

              Thanks again for the help.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 7 Feb 2017, 08:53 last edited by
                #7

                No issue in using it.

                The only thing to take into account is that any update to the Qt provided xcb library won't happen until next release of Qt (unless you're building from the latest git revision) while your system xcb will follow your distribution updates.

                That's a tradeoff that only you can decide upon.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                H 1 Reply Last reply 31 Mar 2021, 03:40
                1
                • S SGaist
                  7 Feb 2017, 08:53

                  No issue in using it.

                  The only thing to take into account is that any update to the Qt provided xcb library won't happen until next release of Qt (unless you're building from the latest git revision) while your system xcb will follow your distribution updates.

                  That's a tradeoff that only you can decide upon.

                  H Offline
                  H Offline
                  HankLA
                  wrote on 31 Mar 2021, 03:40 last edited by
                  #8

                  @SGaist OK, but how to disable it?

                  After update 5.15 (the removed -qt-xcb). Static Qt builds do not run without installing additional packages.
                  Installation of additional packages makes the purpose of static linking pointless. Qt Architects don't understand it?

                  How to build empty STATIC (without libs in boundled directory) Qt application and run it on clean Ubuntu 20 system WITHOUT installation any additional packages?
                  It's impossible for now.

                  J 1 Reply Last reply 31 Mar 2021, 05:40
                  0
                  • H HankLA
                    31 Mar 2021, 03:40

                    @SGaist OK, but how to disable it?

                    After update 5.15 (the removed -qt-xcb). Static Qt builds do not run without installing additional packages.
                    Installation of additional packages makes the purpose of static linking pointless. Qt Architects don't understand it?

                    How to build empty STATIC (without libs in boundled directory) Qt application and run it on clean Ubuntu 20 system WITHOUT installation any additional packages?
                    It's impossible for now.

                    J Online
                    J Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on 31 Mar 2021, 05:40 last edited by
                    #9

                    @HankLA said in Qt Static Compile Linux - Error Loading libxcb-xinerama.so:

                    Qt Architects don't understand it?

                    Please read https://forum.qt.io/topic/113070/qt-code-of-conduct before writing such posts.
                    And also please realize that this is user forum mainly driven by volunteers, no need to use such language...

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    H 1 Reply Last reply 31 Mar 2021, 16:37
                    0
                    • J jsulm
                      31 Mar 2021, 05:40

                      @HankLA said in Qt Static Compile Linux - Error Loading libxcb-xinerama.so:

                      Qt Architects don't understand it?

                      Please read https://forum.qt.io/topic/113070/qt-code-of-conduct before writing such posts.
                      And also please realize that this is user forum mainly driven by volunteers, no need to use such language...

                      H Offline
                      H Offline
                      HankLA
                      wrote on 31 Mar 2021, 16:37 last edited by
                      #10

                      @jsulm
                      My claim is not addressed to the forum participants of course.
                      It's addressed to the product managers directly. Perhaps there was a misunderstanding becouse of my lame English, sorry. I don’t want to sound rude.
                      One need to understand that we pay money for the ability to distribute our software with a static link. This option is almost broken even for empty projects.
                      The situation (static link) gets worse from version to version.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 31 Mar 2021, 18:57 last edited by
                        #11

                        If you have a license than contact the Qt Company directly with your issue, as @jsulm wrote, this is a volunteer driven user forum.

                        As for your issue: Qt 5.15 dropped one of xcb in-tree library because all the officially supported distributions are providing it. All the in-tree included external libraries require work to keep up to date it terms of version as well as security which is work already handled by distribution hence dropping.
                        If you want a really fully static Qt, you would also need to provide a static OpenSSL, MySQL, etc...

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        H 1 Reply Last reply 31 Mar 2021, 22:56
                        1
                        • S SGaist
                          31 Mar 2021, 18:57

                          If you have a license than contact the Qt Company directly with your issue, as @jsulm wrote, this is a volunteer driven user forum.

                          As for your issue: Qt 5.15 dropped one of xcb in-tree library because all the officially supported distributions are providing it. All the in-tree included external libraries require work to keep up to date it terms of version as well as security which is work already handled by distribution hence dropping.
                          If you want a really fully static Qt, you would also need to provide a static OpenSSL, MySQL, etc...

                          H Offline
                          H Offline
                          HankLA
                          wrote on 31 Mar 2021, 22:56 last edited by
                          #12

                          @SGaist

                          @SGaist said in Qt Static Compile Linux - Error Loading libxcb-xinerama.so:

                          If you have a license than contact the Qt Company directly with your issue

                          Unforunatly, it does not work for the "static build" issues.

                          I've spent many weeks doing Qt static builds for linux and macOS, including OpenSSL. Before version Qt 5.15 it was very tricky but possible (except some special issues with ICU). Application run without installation packages and any additionl libs on Ubuntu 16 and higher.

                          But now, they removed -qt-xcb flag ( https://doc.qt.io/qt-5/linux-requirements.html ) and the number of dependencies has grown dramatically.

                          Below I will talk about an empty Qt application only. Without OpenSSL, curl, etc.

                          Here is dependency list of the empty app run at Ubuntu 20. Build station: static Qt 5.15 and ubuntu 16.

                          alex@alex-ubuntu-clean:~$ ldd test
                          	linux-vdso.so.1 (0x00007ffeb7793000)
                          	libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff32d63a000)
                          	libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff32d57b000)
                          	libxcb-glx.so.0 => /lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007ff32d55e000)
                          	libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007ff32d559000)
                          	libxcb-icccm.so.4 => /lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007ff32d552000)
                          	libxcb-image.so.0 => /lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007ff32d34d000)
                          	libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007ff32d346000)
                          	libxcb-keysyms.so.1 => /lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007ff32d341000)
                          	libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007ff32d32e000)
                          	libxcb-render-util.so.0 => /lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007ff32d327000)
                          	libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007ff32d31d000)
                          	libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007ff32d313000)
                          	libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007ff32d302000)
                          	libxcb-shape.so.0 => /lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007ff32d2fd000)
                          	libxcb-xinerama.so.0 => not found
                          	libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007ff32d2df000)
                          	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff32d2b5000)
                          	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff32d178000)
                          	libxkbcommon-x11.so.0 => /lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007ff32d16b000)
                          	libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007ff32d129000)
                          	libicui18n.so.55 => not found
                          	libicuuc.so.55 => not found
                          	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff32d123000)
                          	libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007ff32d09b000)
                          	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff32d076000)
                          	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff32ce95000)
                          	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff32cd46000)
                          	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff32cd2b000)
                          	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff32cb39000)
                          	/lib64/ld-linux-x86-64.so.2 (0x00007ff32d692000)
                          	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff32cb0b000)
                          	libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff32cb00000)
                          	libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ff32cac8000)
                          	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff32caac000)
                          	libxcb-util.so.1 => /lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007ff32c8a6000)
                          	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff32c8a0000)
                          	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff32c896000)
                          	libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007ff32c7de000)
                          	libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007ff32c7aa000)
                          	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ff32c790000)
                          

                          Of cource it does not start.

                          alex@alex-ubuntu-clean:~$ ./test
                          ./test: error while loading shared libraries: libxcb-xinerama.so.0: cannot open shared object file: No such file or directory
                          

                          So, I need to build package or installer. Here is dependency list of the not empty real app. Build station: static Qt 5.14.2 and ubuntu 16.

                          alex@alex-ubuntu-clean:~/Documents/rms.viewer.1.0.7.b7$ ldd viewer
                          	linux-vdso.so.1 (0x00007ffcdef1a000)
                          	libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f719bbde000)
                          	libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f719bb1f000)
                          	libxcb-glx.so.0 => /lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f719bb02000)
                          	libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f719bafd000)
                          	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f719bad3000)
                          	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f719b996000)
                          	libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007f719b952000)
                          	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f719b94c000)
                          	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f719b930000)
                          	libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f719b8a8000)
                          	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f719b885000)
                          	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f719b6a4000)
                          	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f719b553000)
                          	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f719b538000)
                          	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f719b346000)
                          	/lib64/ld-linux-x86-64.so.2 (0x00007f719bc36000)
                          	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f719b318000)
                          	libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f719b30f000)
                          	libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f719b2d7000)
                          	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f719b2cf000)
                          	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f719b2c7000)
                          	libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f719b20f000)
                          	libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f719b1db000)
                          	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f719b1c1000)
                          

                          It's not perfect, but it's acceptable and it works on many systems.

                          1 Reply Last reply
                          0
                          • S SGaist
                            6 Feb 2017, 22:03

                            Hi and welcome to devnet,

                            IIRC, when presented with both option the linker uses the shared library. Note that if you don't need Xinerama support for your application you can also disable the option.

                            Also, don't forget the implication about using a static build of Qt.

                            D Offline
                            D Offline
                            dearqt
                            wrote on 4 Apr 2023, 06:43 last edited by
                            #13

                            @SGaist Hello sir, can you explain what is Xinerama support and what xinerama is used for in qt. I want to disable it but I do not know if I need it or not? Thanks in advance.

                            1 Reply Last reply
                            0
                            • Q Offline
                              Q Offline
                              qDebug
                              wrote on 4 Apr 2023, 11:34 last edited by
                              #14

                              I'm no expert but as far as i know, there is static and static. First static is static Qt-Libs second static is a real static standalone executable file.

                              If you want a real standalone executable you have to get a static version of all dependencies ".a" files not ".so". And you have to add some magic to the compiler -static -static-libgcc -static-libstdc++ (add in the Qt source to qtbase/mkspecs/linux-g++/qmake.conf) and if you want to use any kind of networking, you may also need static nss https://github.com/nss-dev/nss (some Linux versions still got static nss avaliable over packed managers).

                              And even if you don't use networking in your app, some other libs may include networking even if you don't use it in your code directly.

                              Good luck! :)

                              1 Reply Last reply
                              0

                              • Login

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