Is this possible? From what I could gather, the compiler should look for libraries in the directories given in LIBRARY_PATH when compiling, but this code I was compiling was complaining that it couldn't find a library until I set the path in LD_LIBRARY_PATH. I know I'm not giving any concrete information yet, but I wanted to check my hypothesis first:
What I'm trying to compile is an executable that uses lib1.so, which in turn uses lib2.so. Is it possible that it looks for lib1.so (which is the one directly linked to the executable) in LIBRARY_PATH, whereas it looks for lib2.so (which is used by the linked library but not linked directly) in LD_LIBRARY_PATH? In any case: is this common behavior or is it a sign that there is something awkward in the library dependencies in my makefile?
EDIT: Compilation commands for the library
[list of objects] -fPIC -shared -Wl,-rpath='$ORIGIN/' -l2.so -o lib1.so