Penguin
Note: You are viewing an old revision of this page. View the current version.

Where can I set paths to the directories my shared libraries are stored in?

The list of directories to be searched is stored in the file /etc/ld.so.conf. Simply append your desired directory to this file.

  • echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf

Now run ldconfig -v

Note : ldconfig must be run whenever a DLL is added, when a DLL is removed, or when the set of DLL directories changes

Which libraries is my system aware of?

  • ldconfig -Nv

Environment Variables

LD_LIBRARY_PATH

A colon-separated set of directories where libraries should be searched for first, before the standard set of directories.

  • export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/new/dir/to/add"

LDLIBS

Contains a list of external libraries to link with.

For example to link with the libtrace library and the math library:

  • export LDLIBS="-ltrace -lm"