When create executable or dynamic library, sometimes they need to depends on third-party shared library, so how system find the third-party shared library and how can you make sure the system find the right version of library instead of some library in same name?
Solution could be pack the correct third-party library with your executable or library, but how to let system find the packed library? most platform has search directory list to find dependent libraries, even you put the third-party library in the same directory, the system still could find wrong one.
So on Linux/Unix like system RPATH will be the solution, on Mac system install-name of third-party library will be the key.
Below is web-pages talking about install-name and RPATH:
- http://log.zyxar.com/blog/2012/03/10/install-name-on-os-x/
- https://wincent.com/wiki/@executable%5Fpath,%5F@load%5Fpath%5Fand%5F@rpath
- http://www.cmake.org/Wiki/CMake%5FRPATH%5Fhandling
- https://enchildfone.wordpress.com/2010/03/23/a-description-of-rpath-origin-ld%5Flibrary%5Fpath-and-portable-linux-binaries/
- http://man7.org/linux/man-pages/man8/ld.so.8.html