Linking to a specific version of a shared library on Linux

My build process consists of a Maket Qt qmake generator and a typical make utility bundled with linux.
My application consists of several shared libraries, and the main application is associated with them.
How can I apply a typical Linux versioning scheme in my libraries? (Use the version 2 link → against foo.so.2, which points to foo.so.2.yz with the ldconfig link created).

The answer does not have to be specific to my build process.

+4
source share
1 answer

Your library should be named libfoo.so.2.yz , with symbolic links libfoo.so.2 and libfoo.so pointing to this. The library must be created using -soname libfoo.so.2 on the linker command line (or -Wl,-soname,libfoo.so.2 on the gcc command line).

Hope this helps!

+8
source

Source: https://habr.com/ru/post/1277486/


All Articles