Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking against a specific shared library version in linux

My build process consists of Qt's qmake Makefile generator and the typical make utility bundled with linux.
My application consists of a few shared libraries and the main application is linked against them.
How can I apply the typical linux versioning scheme on my libraries? (Use version 2 -> link against foo.so.2 that points to foo.so.2.y.z with an ldconfig generated link).

The answer doesn't have to be specific for my build process.

like image 368
Yorgos Pagles Avatar asked Mar 02 '23 06:03

Yorgos Pagles


1 Answers

Your library should be named libfoo.so.2.y.z, with symlinks of libfoo.so.2 and libfoo.so both pointing to that. The library should be created using -soname libfoo.so.2 in the linker command line (or -Wl,-soname,libfoo.so.2 on the gcc command line).

Hope that helps!

like image 130
Chris Jester-Young Avatar answered Mar 05 '23 15:03

Chris Jester-Young