When i run through the compile process of a project, quite often i need to use a custom library compiled and stored somewhere that is not in the path. At the start of the compile, I can specify the path to the include headers and the library directly, and the project compiles fine.
However, when i check later using ldd, very often ldd shows the library is not found. Usually i will use patchelf to change the runpath to point to the correct library directory and this resolves itself. Still why does this happen?