At runtime, the linker determines where to find the dynamic libraries that an executable needs from:
The value of LD_LIBRARY_PATH at runtime
The paths that had been specified by -R at the time the executable file was built
As noted earlier, use of LD_LIBRARY_PATH can have unexpected side-effects and is not recommended.