
Toolchains
Ship a Library With a pkg-config .pc File
Write a pkg-config .pc file so users get the right include paths and link flags for your library with one command, and install it where pkg-config will find it.
6 min read
Tag
4 posts

Write a pkg-config .pc file so users get the right include paths and link flags for your library with one command, and install it where pkg-config will find it.

Build a versioned shared library with -Wl,-soname, upgrade it in place so programs pick up a patch, and ship an ABI break under a new soname.

A shared library has three names: the linker name used at build time, the soname recorded in binaries and the real name of the file. See how they fit together.

Build static and shared libraries in C with ar, gcc and ld, then link, version, install and debug them, with a decision table for choosing between the two.