title: LD_LIBRARY_PATH failing while trying to run Qt app
body: <p>I want to run a Qt 5 based application usind dynamic libraries on Linux. In summary, a script will copy the executable and other relevant files, including all required .so inside a <code>lib</code> folder, to the desired destination and a script calling <code>gksudo</code> will work as caller to the app.</p>
  
  <p>Till now everything works fine till I call the executable script: the app doesn't run. When I ask to run with <code>sudo</code>, it tells me that a library (Qt5SerialPort...) is missing. Running <code>ldd</code> over the actual executable I discover that the app is getting the required libs not from within the <code>lib</code> folder, but some apparent hard-coded paths.</p>
  
  <p>I tried to solve this by using <code>qt.conf</code> but got no success. As note <a href="https://forum.qt.io/topic/25726/qt-5-linux-deployment-using-qt-conf-for-dynamic-linking/13" rel="nofollow">here</a>, it would seem <code>qt.conf</code> isn't actually supposed to work this way. Consulting the <a href="http://doc.qt.io/qt-4.8/deployment-x11.html#creating-the-application-package" rel="nofollow">Qt documentation</a>, I decided to use <code>LD_LIBRARY_PATH</code> to tell the linker where to find the libs since I was already using a script to run the app anyway. So the final, summarized script code is</p>
  
  <pre><code>#!/bin/sh
  LD_LIBRARY_PATH=lib/
  export LD_LIBRARY_PATH
  sudo ldconfig #sometimes  sudo /sbin/ldconfig -v
  gksudo "$INSPATH/myApp" #or sudo instead
  </code></pre>
  
  <p>Problem is that it is still not working. When I call <code>echo $LD_LIBRARY_PATH</code>, I can see the variable was properly edited, but when I call the run line (with sudo), it keeps telling me that lib wasn't found.</p>
  
  <p>What am I missing?</p>