LD_LIBRARY_PATH is an environmental variable that will contain one or more paths (directories) that will be searched when the linker is searching for a shared library file. For example, LD_LIBRARY_PATH may contain something like this. In this example, the /usr/local/foo and /usr/local/bar directories will be searched for shared library files before the /usr/lib and /usr/lib64 directories are searched for shared library files. This is very similar to $PATH.
LD_LIBRARY_PATH=/usr/local/foo:/usr/local/bar
LD_LIBRARY_PATH can temporarily be defined on the command line.
~]# export LD_LIBRARY_PATH=/opt/foo:/usr/bar
~]# echo $LD_LIBRARY_PATH
/usr/local/foo:/usr/local/bar
LD_LIBRARY_PATH can be defined in your /home/username/.bash_profile file so that every time you sign into the system, your LD_LIBRARY_PATH will contain the directories defined in your .bash_profile file.
export LD_LIBRARY_PATH=/usr/local/foo:/usr/local/bar
Did you find this article helpful?
If so, consider buying me a coffee over at