Strange behaviour of a program built with a static Qt
-
Dear all,
I’ve made a program, whose name is "PlotXY", that I compiled successfully for Win and Mac.
The windows version is built using a static build of Qt.Even though I’m not an Ubuntu user, I want to make an Ubuntu version as well, using static Qt link.
I created two virtual box virtual machines, one (“UbuntuQt”) in which I installed Qt, the other (“Vanilla”) without it for testing purposes.
In "UbuntuQt" I created a static Qt using the following commands:
./configure -qt-xcb -static -prefix /home/massimo/QtStatic
make
make installOnce PlotXY is compiled with static Qt and run directly double-clicking on its icon from inside "UbuntuQt" it loads and shows correctly.
However, if I run the same program from inside "Vanilla", the result is very surprising: the main window appears, but without any text in it. I mean: all the labels' text and all the text on the buttons has disappeared.
Except for this, the window is ok: its layout, its graphical elements.
One of the main window buttons is an "Open..." button. It causes execution of a QFileDialog object. Even in this dialog no text is shown: no file names, no folder names.
Naturally, when running the (statically built) PlotXY executable from "UbuntuQt", also the FileDialog window is correct, and contains all its text.Can someone explain this?
Any idea on how to solve this problem? -
Hi and welcome to devnet,
Did you check your application dependencies running ldd ?
-
Ah, it was my mistake.
The dynamically linked version of the program has a size of 885k bytes and ldd gives a lot of dependencies.
The statically linked version has a size of 23.8 MB and I expected to have no dependencies.
But if I ldd it I get as follows:
linux-gate.so.1 => (0xb7762000)
libX11-xcb.so.1 => /usr/lib/i386-linux-gnu/libX11-xcb.so.1 (0xb7745000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb7720000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb75d4000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75cf000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb75c6000)
libGL.so.1 => /usr/lib/i386-linux-gnu/mesa/libGL.so.1 (0xb751c000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb74ff000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb7387000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb733a000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb731c000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7161000)
/lib/ld-linux.so.2 (0x800c6000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb715d000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb7155000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb712c000)
libglapi.so.0 => /usr/lib/i386-linux-gnu/libglapi.so.0 (0xb7111000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb70fc000)
libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb70f8000)
libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb70f0000)
libxcb-glx.so.0 => /usr/lib/i386-linux-gnu/libxcb-glx.so.0 (0xb70d5000)
libxcb-dri2.so.0 => /usr/lib/i386-linux-gnu/libxcb-dri2.so.0 (0xb70cf000)
libxcb-dri3.so.0 => /usr/lib/i386-linux-gnu/libxcb-dri3.so.0 (0xb70cb000)
libxcb-present.so.0 => /usr/lib/i386-linux-gnu/libxcb-present.so.0 (0xb70c7000)
libxcb-sync.so.1 => /usr/lib/i386-linux-gnu/libxcb-sync.so.1 (0xb70be000)
libxshmfence.so.1 => /usr/lib/i386-linux-gnu/libxshmfence.so.1 (0xb70bb000)
libXxf86vm.so.1 => /usr/lib/i386-linux-gnu/libXxf86vm.so.1 (0xb70b4000)
libdrm.so.2 => /usr/lib/i386-linux-gnu/libdrm.so.2 (0xb70a4000)Why so many dependencies? Maibe I created a faulty static Qt?
-
Having a static Qt doesn't mean that all dependencies are gone. Qt might be static but unless you also link to the static version of all its dependencies, what you have is normal: OpenGL and the xcb plugin deps.