title: Can LD_PRELOAD be used to load different versions of glibc?
body: <h2>Cast of characters</h2>
  
  <ul>
  <li><code>big-old-app</code> is linked to an old version of <code>glibc</code>, say <code>glibc-2.12</code>.  I cannot do anything to change this.</li>
  <li><code>cute-new-addon.o</code> is linked to a newer version, <code>glibc-2.23</code>.  This <code>glibc-2.23</code> is in a nonstandard path (because I don't have sudo powers).</li>
  </ul>
  
  <h2>The story</h2>
  
  <p>I want to use <code>cute-new-addon.o</code> inside <code>big-old-app</code>.  I would normally write a script for <code>big-old-app</code> to execute, which then calls <code>cute-new-addon.o</code> to perform its tricks. From the command line, it would look like:</p>
  
  <pre><code>$ big-old-app script.txt
  </code></pre>
  
  <p>However, when I do that, <code>big-old-app</code> would complain that <code>cute-new-addon.o</code> cannot find <code>glibc-2.23</code>.  That's understandable, because I have not specified any standard paths.  What if I do:</p>
  
  <pre><code>$ LD_LIBRARY_PATH=/path/to/mylibs:$LD_LIBRARY_PATH big-old-app script.txt
  </code></pre>
  
  <p>It segfaults! :(</p>
  
  <p>I think this is because <code>big-old-app</code> references a newer <code>mylibc.so.6</code>.  When doing so, the implementations are no longer what <code>big-old-app</code> is used to, so it segfaults.</p>
  
  <h2>The question</h2>
  
  <p>Regarding <code>script.txt</code>, I don't think I have the ability to specify the newer <code>mylibc.so.6</code> before invoking <code>cute-new-addon.o</code>.  <code>big-old-app</code> and <code>cute-new-addon.o</code> are tightly intertwined that I have no way of knowing when either of them need their corresponding <code>glibc</code>.</p>
  
  <p>And yes, <code>cute-new-addon.o</code> <code>rpath</code> is pointed to <code>/path/to/mylibs</code> and I can confirm via <code>ldd</code> that all the libraries it needs, it looks for in <code>/path/to/mylibs</code>.</p>
  
  <p>Can I use <code>LD_PRELOAD</code> to load two different versions of <code>glibc</code>? And let <code>big-old-app</code> and <code>cute-new-addon.o</code> look for what they need as they please?</p>