title: Qt, Linux, GCC: -Wl,-rpath=$ORIGIN not working for platform plugin xcb
body: <p>I am trying to deploy a C++ application compiled with gcc on Linux by putting the required .so files into the executable directory. I added the linker flag <code>-Wl,-rpath=$ORIGIN</code> so that the program may look for the linked libraries in the directory where it's located. This works so far as that all libraries that are directly linked with my executable are found (checked via ldd).</p>
  
  <p>However, when I try to launch the application I get the following error:</p>
  
  <pre><code>This application failed to start because it could not find or load the Qt platform plugin "xcb".
  
  Available platform plugins are: linuxfb, minimal, offscreen, xcb.
  
  Reinstalling the application may fix this problem.
  </code></pre>
  
  <p>The platform plugins are located in the folder <code>./platforms</code> (relative to the executable path). Those some other shared object files which are apparently loaded by Qt, one of them being <code>libqxcb.so</code>. Now, the problem is that this file again depends on <code>libQt5Gui.so</code>, <code>libQt5Core.so</code> etc. These are located in my application path, but I suspect that the <code>libqxcb.so</code> is somehow not able to find them there, thus it fails. Is there a possibility how I could fix this?</p>
  
  <p>If I use the following script to run the application, it works (note: <code>Ct</code> is the name of the executable):</p>
  
  <pre><code>#!/bin/sh
  
  DIR="$( cd "$( dirname "$0" )" &amp;&amp; pwd )"
  cd $DIR
  LD_LIBRARY_PATH=LD_LIBRARY_PATH:. ./Ct
  </code></pre>
  
  <p>But I would like to achieve this without having to use a script to run the application.</p>