title: Link against non-default glibc
body: <p>I'm trying to link <a href="https://github.com/andikleen/glibc" rel="nofollow">Andi Kleen's glibc implementation</a> to enable lock-elision for a program with pthreads.
  I link my program as follows:</p>
  
  <pre><code>g++ \
  -Wl,--rpath=/path/glibc-elision/build/lib \
  -Wl,--dynamic-linker=/path/glibc-elision/build/lib/ld-linux-x86-64.so.2 \
  -o program program.o \
  -fgnu-tm -mrtm -pthread \
  -Wl,--no-as-needed --enable-lock-elision=yes
  </code></pre>
  
  <p>As long as I don't use any components of the libstdc++, everything works fine.</p>
  
  <p>But as soon, as e.g. <code>std::vector</code> is referenced, the dynamic linker can't find the libstdc++.so.6 (<code>error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory</code>).</p>
  
  <p>To resolve this error, I tried to provide the custom as well as the standard glibc with <code>-Wl,--rpath=/path/glibc-elision/build/lib;/usr/lib/x86_64-linux-gnu/libstdc++.so.6</code>.
  This is not the correct call but the idea is to somehow provide both libraries.</p>
  
  <p>So the question is:</p>
  
  <p><strong>How to link a program against different components of two glibcs?</strong></p>
  
  <p>I'm working on Ubuntu 13.10 with gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1.</p>