Important: Please read the Qt Code of Conduct -

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 install

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

  • Lifetime Qt Champion

    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: => (0xb7762000) => /usr/lib/i386-linux-gnu/ (0xb7745000) => /usr/lib/i386-linux-gnu/ (0xb7720000) => /usr/lib/i386-linux-gnu/ (0xb75d4000) => /lib/i386-linux-gnu/ (0xb75cf000) => /lib/i386-linux-gnu/ (0xb75c6000) => /usr/lib/i386-linux-gnu/mesa/ (0xb751c000) => /lib/i386-linux-gnu/ (0xb74ff000) => /usr/lib/i386-linux-gnu/ (0xb7387000) => /lib/i386-linux-gnu/ (0xb733a000) => /lib/i386-linux-gnu/ (0xb731c000) => /lib/i386-linux-gnu/ (0xb7161000)
    /lib/ (0x800c6000) => /usr/lib/i386-linux-gnu/ (0xb715d000) => /usr/lib/i386-linux-gnu/ (0xb7155000) => /lib/i386-linux-gnu/ (0xb712c000) => /usr/lib/i386-linux-gnu/ (0xb7111000) => /usr/lib/i386-linux-gnu/ (0xb70fc000) => /usr/lib/i386-linux-gnu/ (0xb70f8000) => /usr/lib/i386-linux-gnu/ (0xb70f0000) => /usr/lib/i386-linux-gnu/ (0xb70d5000) => /usr/lib/i386-linux-gnu/ (0xb70cf000) => /usr/lib/i386-linux-gnu/ (0xb70cb000) => /usr/lib/i386-linux-gnu/ (0xb70c7000) => /usr/lib/i386-linux-gnu/ (0xb70be000) => /usr/lib/i386-linux-gnu/ (0xb70bb000) => /usr/lib/i386-linux-gnu/ (0xb70b4000) => /usr/lib/i386-linux-gnu/ (0xb70a4000)

    Why so many dependencies? Maibe I created a faulty static Qt?

  • Lifetime Qt Champion

    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.

Log in to reply