title: How to replace the library shared object using PatchELF or chrpath
body: <p>Recently, I want run old application compiled by GCC 3.4.5 on the newest Linux system running GCC 5.2.0.
  There is an conflict of the GCC version.
  I catch some follow idea:</p>
  
  <ol>
  <li>I can rebuild the GCC 3.4.5 on myself specific directory ${MYLIB_DIR}, and compile my application, then deploy it on the GCC 5.2.0 &amp; export LD_LIBRARY_PATH using ${MYLIB_DIR}. But it's wrong because of LD_LIBRARY_PATH will work on the other application, such as shell command: ls, ldd... so this way can't be work.</li>
  <li>Use command chrpath or patchelf. I can change the runpath of my application, instead of not influence on other applications. But there is some library shared object can't be search in my own directory ${MYLIB_DIR}, such as libcom_err.so, libdl.so.</li>
  </ol>
  
  <p>I'd like to use the second method, the libpthread.so can be searched and replaced exactly, but I want to know how to let GCC search the libcom_err.so in my own ${MYLIB_DIR}?</p>