title: How to link to a shared library without lib* prefix in a different directory?
body: <p>I have to link my code to a shared library without the lib prefix. (say, foo.so) The first problem is -l option does not find the file. So I tried directly including this file to the last compilation like this:</p>
  
  <p>gcc a a.o /PATH/TO/FOO/foo.so </p>
  
  <p>But in this case, a is hard linked to foo.so as an absolute path as seen in "ldd a":</p>
  
  <p>/PATH/TO/FOO/foo.so</p>
  
  <p>In the final deployment both files would end up being in the same folder, so this should be normal link, not the absolute path. How can I do this?</p>