I installed a library(for example lzma-dev) using a package manager(for example apt-get for Debian or Ubuntu). How can I use it? Where can I find the libs and headers? How about sos(dynamic libraries)?

  • 1
    Essentially, any properly set-up distro will ensure that libraries installed via its package manager can be found in directories that are in the compiler's default search path. (Assuming that the compiler was likewise installed via the package manager) – Shadur Feb 13 '14 at 13:40
  • @Shadur this means I can just #include <header.h>(for example for c++ libraries) and use it right along without having to think about adding library and include paths to the porject file, right? – Jason Swartz Feb 13 '14 at 14:18
  • 1
    In most cases, yes, although from the looks of @slm's the files will be at /usr/include/<libname> so the include directive you'll likely need would be #include <libname/header.h> – Shadur Feb 13 '14 at 14:37

Assuming the package has already been installed you can see the contents of it using dpkg -L, for list.


$ dpkg -L lzma-dev

Packages that are named <something>-dev are typically just the C header files (.h files), this package is a bit unusual in that it includes (.c and .h files). Incidentally this is the actual source for the LZMA library.

If you want the .so files and the .h files for the LZMA library, so you can compile against it, you'll need to install the 'liblzma-dev` package.


Here's the header files.

$ dpkg -L liblzma-dev | tail -15

As well as the actual .so library:

$ dpkg -L liblzma5 | tail -4
  • "and the .c and .h files for the LZMA library". The .c files are not packaged. They're source. Also, .so files are not part of a dev library, which just contain header files. The /usr/lib/x86_64-linux-gnu/liblzma.so here is a symbolic link. It points to a file in the library package liblzma5. – Faheem Mitha Feb 13 '14 at 18:31
  • @FaheemMitha - take a look at the contents of lzma-dev, it does contain .c files. – slm Feb 13 '14 at 18:39
  • @FaheemMitha - cleaned it up but this is a bit of a confusing example. – slm Feb 13 '14 at 18:45
  • @FaheemMitha - 12.10, lzma-dev: 9.22-2ubuntu2 – slm Feb 13 '14 at 22:50
dpkg -L lzma-dev

list all the files installed with apt-get for lzma-dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.