title: Deploying Qt applications in Linux properly
body: <p>I have written an application using Qt and I am trying to deploy it. I built my application it and tried distributing it, but I ended up having to build Qt statically so that users don't need to install Qt's libraries just to run my application. The only problem is that the fonts are broken, and images don't load.</p>
  
  <p>To statically build Qt, I did this:</p>
  
  <pre><code>./configure -static -release -ltcg -optimize-size -no-pch -prefix "/home/myuser/Qt/5.11.1-static" -skip webengine -nomake tools -nomake tests -nomake examples -fontconfig
  make -j4
  make -j4 install
  </code></pre>
  
  <p>There was then the issue of fonts not working. I kept getting the error "QFontDatabase: Cannot find font directory (Qt install directory)/libs/fonts", so I copied the dejavu fonts folder on my system to a folder called "fonts" in my program's directory and created a Bash script that set QT_QPA_FONTDIR to the new font directory. This made the error go away and made the text on my application visible, but when a password is being entered blank characters are displayed instead of asteriks or any other characters. Additionally, images do not show. I have a folder in the same directory as the application called "images" with my images inside, so I did this:</p>
  
  <pre><code>QIcon home("(program directory)/images/home.svg");
  QIcon vpn("./images/vpn.svg");
  ui-&gt;tabWidget-&gt;setTabIcon(0, home);
  ui-&gt;tabWidget-&gt;setTabIcon(1, vpn);
  </code></pre>
  
  <p>The images do not show, but they do if the program is built using dynamic Qt. I tried both the full path and using ./ to refer to the current directory, but neither one results in the image appearing.</p>