Please nominate your Qt Champions for 2021!

Statically-linked application doesn't show any text

  • I have a Qt widgets application that runs perfectly when run with the installed Qt (5.12.4). I followed the instructions to make it a statically-linked application so I can deploy it to another computer. When I first ran it, I didn't see any text in the appliaction and I saw errors in the logs about fonts not being available. I installed the dejavu fonts to ~/Qt-5124/lib/fonts. Now, I don't get any errors in the logs, but I still don't see the text. I'm wondering if it's a font issue. The font that is being uses is "Ubuntu." I believe that is a system font. Should the application be able to display system fonts?

    0_1561577753834_GoodImage.PNG 0_1561577760091_BadImage.PNG

  • Lifetime Qt Champion


    Check with QFontDatabase what font you have access to and if the one you want to use loads properly.

  • @SGaist I addded a function at the beginning to "qDebug()" the list of fonts from QFontDatabase.

    When I run interactively with plugin support, I see that I have access to a whole bunch of fonts. When I run as a statically-linked application, I see that I have zero fonts available.

    I looked at the config.summary of my static build of Qt. It showed that fontconfig was not enabled. I thought I'd try to enable it by adding a switch to the configure command, "-fontconfig." But I received additional errors:

    ../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124 -system-xcb -recheck-all -system-fontconfig

    ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.msvc && features.system-freetype && libs.fontconfig' failed.

    I'm running on an ubuntu VM.

    Do you know how to enable system fonts in the static build?

  • Lifetime Qt Champion

    Add the fontconfig development package to your system.

  • @SGaist I tried apt-get install fontconfig-dev and received an error that the package doesn't exist. I tried apt-cache search fontconfig. I didn't see anything like a development package for fontconfig. Do you know how to install it?

  • Lifetime Qt Champion

    What about libfontconfig1-dev ?

  • @SGaist said in Statically-linked application doesn't show any text:


    That looks like the solution. Thank you.

Log in to reply