Hi,
I am trying to understand what causes the search path for a shared library to be hardcoded in to an dynamically linked executable.
Also how can one avoid this, so that a user may run the executable with
say processor optimised libraries, in a non-standard location.
Any pointer to information would be much appreciated. Please note this is for a libc6 environment, in fact it is to prevent the libc6 path itself from being hardcoded in to an executable.
I am aware that one may use -rpath to specify an alternative search path
but this does not solve my problem of letting the user place the library
at any location.
sincerely B Thomas
I don't believe that there is away (at least if there is, I am not aware) to hardcode the library path in the executable. The library search path is a function of the system's dynamic linker.
In the case of ld, it searches any directories specified in the LD_LIBRARY_PRELOAD environment variable, followed by any directories specified in the /etc/ld.so.conf config file, and finally /usr/lib and /lib.
You may want to try changing the order of directories in /etc/ld.so.conf and running ldconfig.
You also nood to run ldconfig after adding any new libraries to /usr/lib or /lib or any directories in /etc/ld.so.conf.
-Roberto
signature.asc
Description: OpenPGP digital signature