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



  • 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?


  • Moderators

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



  • 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?



  • 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.


  • Lifetime Qt Champion

    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.



  • @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.


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.