We deploy our application with all the necessary dependencies in one directory. Our application sets LD_LIBRARY_PATH to this location. Some of the libraries (for instance OpenSSL) are also present at system locations. And indeed when we remove such a shared object from the application directory the application still runs with all possible disasters (like wrong version). I would rather have a warning issued that the shared object cannot be found if I remove it from the application directory

Is it possible to reset the search path of the dynamic loader such that indeed it only looks in the LD_LIBRARY_PATH for certain objects?

1 Answer 1


I don't think you can prevent the search for libraries in the system path at runtime, but according to the ld.so man page, if you link the binary with -z nodeflib the dynamic linker won't search the system library path. I don't see this in the man page for ld, so I don't know if this is actually supported.

Another idea: look into using a container system like docker. This is similar to a light weight virtual machine in that you can have your own filesystem view that is separate from the host, and you can just put the library versions you want in the container. It also works for things other than shared libraries like JVM/python versions and so forth. I haven't used it much myself, but my understanding is that it is well suited for these types of applications.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .