$ uname -a
Linux xhost10.bcgsc.ca 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
$ /sbin/ldconfig --version
ldconfig (GNU libc) 2.5
I am installing several binaries and libraries locally, since I do not have root access.
Some of the programs need to dynamically link to a shared library in a non-standard location at runtime.
When executed, the program returns:
$ path/to/cc1
path/to/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
I've added paths to the libraries $LD_LIBRARY_PATH
, but I cannot update the ldconfig
cache without root access...
Is there a user-specific /etc/ld.so.cache
?
Or more generally, is it possible on to 'mask' a system configuration file with a user configuration file?
DESCRIPTION. ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld. so. conf, and in the trusted directories (/lib and /usr/lib).
NAME top. ldconfig - configure dynamic linker run-time bindings.
From the cache file /etc/ld. so. cache, which contains a compiled list of candidate shared objects previously found in the augmented library path. If, however, the binary was linked with the -z nodeflib linker option, shared objects in the default paths are skipped.
The ldconfig command creates a cache database of all libraries based on the configuration file. This cache is normally stored in the /etc/ld. so. cache file.
The ldconfig cache only applies to path specified in /etc/ld.so.conf or /etc/ld.so.conf.d. As these are not writable for non root users you can't use them to improve start speed for executables installed without root permissions without the help of root (but even then it would be a bad idea to add a file writable to a user to these system wide library search pathes).
So for these cases you need to use either the LD_LIBRARY_PATH environment variable or rpath/runpath in the executable or library that depends on libraries in the non default path. I'm not aware of any speed differences between LD_LIBRARY_PATH and rpath/runpath but rpath/runpath have the advantage that they affect only specific executables and thus are less likely to cause problems for other programs.
In linux/unix there is not general way to mask a system configuration file and use a user supplied file instead. In fact that is something that the unix security model actively has to prevent to avoid various kinds of privilege escalation. That's the reasons even many environment variables get disabled for suid executables for example. Many programs have their one ways to specify overriding user configuration, some more complicated ones also have ways for the system administrator to set mandatory settings that are not overridable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With