apt packages – static vs dynamic libraries

I use Ubuntu 18.04. I install libraries using apt, for example:

sudo apt install freeglut3-dev

Does apt always install dynamic libraries or I can determine if a package contains static or dynamic library ?

Asked By: Irbis


By convention: libfoo1 will contain a dynamic library, while libfoo-dev will create the headers and static library.

libfoo1 is only runtime dependencies, and dynamic libraries are runtime dependencies.

libfoo-dev is a build-dependency, and static libraries are only used during building/linking.

If you want to know what’s in a library, you can use dpkg to look at what’s in an installed package:

$ dpkg -L libfoo1

If the package is not installed, you can use the apt-file command, but you need to have recently used apt update to get the file list.

$ apt-file list libfoo-dev
libfoo-dev: /usr/include/foo.h
libfoo-dev: /usr/lib/x86_64-linux-gnu/libfoo.a
libfoo-dev: /usr/lib/x86_64-linux-gnu/libfoo.so

libfoo.so (in libfoo-dev) is actually just a symbolic link to libfoo.so.1 (in libfoo1) which itself is a symbolic link to libfoo.so.1.0.0 (also in libfoo1).

Answered By: Stewart