title: How can I find the full file path given a library name like libfoo.so.1?
body: <p>Without implementing a linker or using <code>ldd</code>, how can I find the full path to a library? Is there a standard library available for that on Linux? (POSIX maybe?)</p>
  
  <p>Using <code>ldd</code> and <code>grep</code> on a file that is knowingly using <code>libGL.so.1</code>, it looks like:</p>
  
  <pre><code>$ ldd /usr/bin/glxinfo | grep libGL
  libGL.so.1 =&gt; /usr/lib/libGL.so.1 (0x00007f34ff796000)
  </code></pre>
  
  <p><strong>Given a library name like <code>libGL.so.1</code>, how can I find the full path <code>/usr/lib/libGL.so.1</code>?</strong>. Preferably accepting an option for finding 32-bit and 64-bit libraries. If no library does that, does a program exist to do this? Something like <code>find-library-path libGL.so.1</code>. The <code>locate libGL.so.1</code> command does not count.</p>
  
  <p>I don't want to actually load the library using <code>dlopen</code> or something if it executes code from that library.</p>