This is a follow-up question to this one.
I understand that using $ORIGIN
in the -rpath
option generates a dynamic absolute path that will always point to the specified location - no matter from where I use the library.
What's confusing me, is the following: I use this library to generate a shared binary and I set (again) the -Wl,-rpath
option using $ORIGIN
to enable the binary to always find its library. Now the original $ORIGIN
value of the library is not available anymore or wrong because it seems to be overwritten by the new one.
Somehow this is understandable since I am now generating a new shared object - the binary - that has its own $ORIGIN
. A way around this, would be to provide the binary's -rpath
with both locations, the one to the library and the one the library itself needs. In my opinion this makes -rpath
almost useless, because I can't just link to the library and specify its location I also need to specify the library's dependency location.
My question: Is there a way to specify hierarchical -rpath
values using $ORIGIN
? I would like to avoid absolute paths, which would obviously fix my issue.