Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
2 of 2 fix grammar

Is it possible to configure dynamic loader for an executable

I am looking for a way to allow an executable to find its shared library, but in order to avoid conflict with any package that could use a different version of the same shared library I prefer to keep these libraries in a 'private path' (not /usr/lib).

The possible ways seems :

  • embbeded rpath in the executable
  • set LD_LIBRARY_PATH when executable is started
  • add libraries path in ldconfig configuration in a file

rpath links target structure to the build, configure path for the system, LD_LIBRARY_PATH need the caller process to be aware of it.

So I was wondering if it is possible to use (or similar loader configuration) applied only for an executable ?