What is the UNIX philosophy regarding absolute and relative paths here?
Using a relative path makes an executable that only works when called from a specific directory, which is almost never needed. For instance. if the executable is located in /app/foo/bin/exe and has DT_RUNPATH of lib/ , and the dependent library is in /app/foo/lib/libfoo.so , then exe will be executed only when called from /app/foo , and not when called from any other directory.
Using the absolute path is much better: you can do cd /tmp; /app/foo/bin/exe cd /tmp; /app/foo/bin/exe and execute the executable. This, however, is not ideal: you cannot easily have multiple versions of the binary (important during development), and you determine to end users where they should install the package.
On systems supporting $ORIGIN , using DT_RUNPATH of $ORIGIN/../lib will give you an executable that works when installed anywhere and is called from any directory if relative paths to bin/ and lib/ are saved.
source share