Qt Static Compile Linux - Error Loading libxcb-xinerama.so
-
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.
-
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.
-
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.
-
@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. -
@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... -
@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. -
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... -
@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.
-
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! :)