From here:
In Linux, the environment variable LD_LIBRARY_PATH is a colon-separated set of directories where libraries should be searched for first, before the standard set of directories
As a tip, you should be careful not to replace entirely your LD_LIBRARY_PATH. It could mess up the path for the system shared libraries.
Always use export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path.
EDIT 1:
As for the rpath, make sure that libTest.so doesn't depend on any other library. As an alternative you can use -rpath-link option in gcc instead of -rpath, as seen here:
-rpath-link DIR
When using ELF or SunOS, one shared library may require another. This happens when an ld -shared link includes a shared library as one of the input files. When the linker encounters such a dependency when doing a non-shared, non-relocateable link, it will automatically try to locate the required shared library and include it in the link, if it is not included explicitly. In such a case, the -rpath-link option specifies the first set of directories to search.
EDIT 2:
If you want more help, please provide:
- Exact parameter for
rpath used during compile
- Output for
ldd /path/to/binary command
- Output for
readelf -d /path/to/binary