On Tue, Jun 21, 2011 at 11:29 AM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 21 June 2011 17:24, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: >> Rename it to libbar.so and link to it with "-L/foo -lbar" instead of >> giving an absolute path to the .so > > Actually I think I've misremembered how it works, you might need to > create bar.so using -soname=bar.so so that ldd will only make it > depend on "bar.so" not the absolute path to the file, and will search > for it in the usual locations. Thanks, unfortunately `bar.so` is a closed-source binary, and `-L/foo -lbar` fails. Is there a way to know which `-soname` `bar.so` was assigned? Maybe it's just different from `bar`, and if I just `-l<actual bar.so name>` I'd be OK? >> Use an RPATH, e.g. link with -Wl,-rpath,'/baz:$ORIGIN/..' will make it >> look in /baz then in .. Thanks, but I take your answer to mean that I can't link relative to a runtime target's environment variable (e.g. `$HOME`)? Thanks, D.