1

I'm being reading about shared libraries versions and sonames and I don't get to understand it.

Soname is supposed to contain only major version number so programs that links to it know that it is binary compatible. If you update your library from 1.0 to 1.1, with aditions to the API but backwards compatible, programs with required library soname libfoo.so.1 will still work.

However, what happen with libraries that require version 1.1 or higher of the library? With soname libfoo.so.1, version 1.0 of the library can be installed in the system where the app is to be run, leading to runtime crashes.

Also, I would like to know how are soname and/or library versions selected when linking at compile time and at runtime. According to the following answer, soname is used at compile time and libraries and symlinks filenames are used at runtime: https://stackoverflow.com/a/14613602. Is this correct?

But then, how do I require a minimum minor version of the library at compile time? Is it not possible? I could require to use libfoo.so.1.1 instead of libfoo.so.1, but then if libfoo.so.1.1 is not installed but libfoo.so.1.2 is, it won't be used.

naggety
  • 166
  • 1
  • 10

0 Answers0