The most common way is to define an environment variable in the shell:
$ export LD_LIBRARY_PATH=/path/to/shared/objects
This operation must be done in every new shell/terminal emulator before starting the process that needs the shared objects located there. To avoid this, you can insert the export in your .bashrc/.profile file (located in your home folder): in this way the variable is set every time you log in.
But sometimes you need a shared object to be called from daemons or processes run by various users. The solution is the file /etc/ld.so.conf. In this file you can add all the paths where shared object should be searched.
In Debian-based distros (like Ubuntu), this file only include the following line:
include /etc/ld.so.conf.d/*.conf
This means that you don't have to change this file but it's sufficient to add your paths to a file with extension .conf located in the directory /etc/ld.so.conf.d/
Pay attention! Adding directories not owned by root can be a security breach because it can lead to the execution of arbitrary code.
Post a Comment