$ORIGIN (or equivalently ${ORIGIN})
This expands to the directory containing the program or
shared object. Thus, an application located in somedir/app
could be compiled with
gcc -Wl,-rpath,'$ORIGIN/../lib'
so that it finds an associated shared object in somedir/lib
no matter where somedir is located in the directory
hierarchy. This facilitates the creation of "turn-key"
applications that do not need to be installed into special
directories, but can instead be unpacked into any directory
and still find their own shared objects.
1 Comments
brianpeiris@lemmy.ca · 12 pts · 43d
https://man7.org/linux/man-pages/man8/ld.so.8.html via https://fzakaria.com/2026/06/21/nix-needs-relocatable-binaries