title: How to copy an executable with all needed libraries?
body: <p>I have two fairly identical (Linux-) systems but one with just a minimum set of packages installed. On one system I have a running (binary/ELF) executable which I want to copy over to the other system (with the minimum setup).</p>
  
  <p>Now I need a way to copy all needed shared libraries as well. Currently I start the application on the source system and then go through the output of</p>
  
  <pre><code>lsof | grep &lt;PID&gt; 
  </code></pre>
  
  <p>or </p>
  
  <pre><code>ldd &lt;FILE&gt;
  </code></pre>
  
  <p>to get a list of all libraries currently loaded by the application and copy them over manually.</p>
  
  <p><strong>Now my question is:</strong> before I start to automate this approach and run into lots of little problems and end up with yet another reinvented wheel - Is there a tool which already automates this for me? The tool I'm dreaming of right now would work like this:</p>
  
  <pre><code>$ pack-bin-for-copy &lt;MY_EXE&gt;
  </code></pre>
  
  <p>which creates a <code>.tgz</code> with all needed shared libraries needed to run this executable.</p>
  
  <p>or</p>
  
  <pre><code>$ cp-bin &lt;MY_EXE&gt; user@target:/target/path/
  </code></pre>
  
  <p>which would just copy the binary once..</p>
  
  <p><strong>Note:</strong> I do NOT need a way to professionally <em>deploy</em> an application (via RPM/apt/etc.). I'm looking for a 'just for now' solution.</p>