3

I have downloaded a precompiled library for which the filename is in the format:

<name>.so.0

I gather this some kind of versioning? How do I use the library - do I need to use a tool to extract it? I think the program will only look for <name> when looking for the file..

markmnl
  • 1,051

1 Answers1

4

Compiled libraries are automatically loaded, when a binary is executed. For this, the locations defined in /etc/ld.so.conf are checked. On most distributions you should put the library in /usr/local/lib, where libraries not installed by the package manager are stored.

If you don't want to install the library system wide (or don't have root access), you can set LD_LIBRARY_PATH to the folder containing your .so-file when running your program:

LD_LIBRARY_PATH=/path/to/folder_with_so_file ./yourprogram

Regarding the version number: if your program explicitly looks for .so without a number, create a symlink (also in the lib folder):

ln -s <name>.so.0 name.so

Most libraries keep the file with the most specific version number and create symlinks for the major version and the non-versioned name (for example on my system /usr/lib contains the files libjpeg.so, /usr/lib64/libjpeg.so.62 and /usr/lib64/libjpeg.so.62.0.0, the former two being symlinks to the latter)

crater2150
  • 3,946