Shared libraries in Linux allow programs to reuse and share code in library modules. This is common across different OS’s and in the windows environment you may recognize these as DLL files. Linux uses the .so extension but often have a version number after .so. To locate shared libraries required for a profram Linux employs two mechanisms:
- LD_LIBRARY_PATH Variable
- /etc/ld.so.conf file
The variable is searched first and then the contents of the file. If changes are made to the file then the cache must be updates with the command:
Changes to variables are dynamic and are effected immediately without the need for updating the cache. The variable is not usually set and allows for modifications on a per-user basis; whereas the main configuration file will effect all users on the system. The video takes you through the process of a new modules needing testing and installed in a test location. The variable is updated for one user who can test that module whilst others users continue to use the program with the original module. The process is transparent to the program and to our users and it all happens in the background.
The command :
Is useful to display the current locations for modules for a particular user and program and:
can be used to print out the cache to screen.
Generally we do not need to become to involved with this as installation program will normally mange the modules and updating of the cache, but as always, when it all goes wrong, we are the ones who have to tidy up the mess so knowing ldd, ldconfig and the variable LD_LIBRARY_PATH are most useful.