When a Linux binary is started, the run-time linker uses three sources for finding the needed libraries. First it is possible to set the LD_LIBRARY_PATH environment variable, second the “rpath” (this is a path encoded into the binary while compile time) and last but not least the systems’ default directory like /usr/lib. Now consider the situation where you have to run a binary on a machine where you don’t have root privileges: Here you can’t just install / copy the library to the standard folder, therefore you have to go for one of the first two solutions. Setting the environment variable is seen as bad practice.
Although using rpath is also seen as evil / bad practice, there are situations where you just have no choice. Therefore just copy the shared library into the same folder as your binary (or whatever folder you also distribute) and compile the binary with the following (additional) linker flags: