title: How do I get dynamic libraries to load from the same directory in Ubuntu?
body: <p>I have an executable which is dynamically linked to foo.so.0 and bar.so.0. The problem is that when I try to run the executable the loader cannot find the dynamically linked libraries. (The executable was linked to a static library which loaded the dynamic version so I dont control any of that directly). I found that I can edit <code>LD_LIBRARY_PATH</code> to include the current directory and then it will find it. The problem is that when the program is run as root, for some reason it still cant find the library. Is the <code>LD_LIBRARY_PATH</code> approach the wrong one? If it is acceptable then why does the program not find the library when run under sudo?</p>