title: Linux binary can't find shared library, but works while running in strace
body: <p>(Note: names of the binary and binary and library below are obfuscated to protect the innocent. ;-) The app is proprietary under NDA but the behavior may not depend on it.)</p>
  
  <p>I have a Linux binary which prints the following error when run:</p>
  
  <blockquote>
    <p>binary: error while loading shared libraries: libshared.so: cannot open shared object file: No such file or directory</p>
  </blockquote>
  
  <p>Which is confusing on its own since libshared.so is in the LD_LIBRARY_PATH. However,</p>
  
  <ul>
  <li><p>The library is found correctly when running <code>ldd binary</code> (i.e., the ldd output points to the file location)</p></li>
  <li><p>The library is found correctly when running <code>strace binary</code>, so that the program manages to print its usage information!</p></li>
  </ul>
  
  <p>I have never seen an application which behaves differently when run on its own vs in strace, but I figure maybe someone else has seen this happen before? Any ideas how to resolve this?</p>
  
  <p>I don't have the source so I can't rebuild. Running the app in production under strace is probably a non-starter. The OS is RHEL 6.2.</p>