How to use PROPERTIES VERSION and SOVERSION?
Friedrich W. H. Kossebau
kossebau at kde.org
Fri Apr 11 15:42:01 CEST 2008
Am Freitag, 11. April 2008, um 14:23 Uhr, schrieb Thiago Macieira:
> On Friday 11 April 2008 14:08:39 Friedrich W. H. Kossebau wrote:
> > Indicator fur human eyes or used by the linker?
> > So kdelibs 4.1 the SOVERSION should be one higher than for kdelibs 4.0?
> > Because code compiled against 4.1 would not see the same ABI when running
> > with 4.0
> >
> > Yet GENERIC_LIB_SOVERSION is just set to "4". I miss something,
> > obviously.
>
> ELF doesn't support that. It should support two numbers: the minimum
> version and the current. That is, kdelibs 4.1 is backwards compatible with
> 4.0; Qt 4.4 is backwards compatible with 4.0 as well (including all
> in-between).
Ah, so that is also the reason for those (for me) strange current and age
parameters of libtool.
> What it supports is the concept of "SONAME". It means that, if the name
> matches, it should be usable. The idea is that *future* versions of that
> library will be compatible with the one you have now. But that doesn't mean
> your application will work with older versions.
... but instead might yield Symbol lookup errors.
So the assumption seems to be: if the developer (and binary creator) has had
access to the latest compatible version of the library, the user has had
already, too, and of course uses it? Hm.
Okay, taken. And then there is packet management, caring for such
dependencies ;)
> > libmylibname.so.6.1 - the real file, name used to separate the different
> > versions
>
> Used by no one.
>
> > libmylibname.so.5 - used by whom? linker?
>
> Used by the dynamic linker (run time).
>
> > libmylibname.so - used by whom? linker?
>
> Used by the static linker (compile time).
>
> Process is:
> 1) static linker (ld) gets -lfoo
> 2) ld finds libfoo.so
> 3) ld extracts the DT_SONAME symbol from the library
> 4) soname = "libfoo.so.N"
> 5) ld writes to the executable: DT_NEEDED "libfoo.so.N"
>
> Later:
> 6) application is loaded
> 7) dynamic linker (ldd) sees DT_NEEDED libfoo.so.N
> 8) ldd tries to load libfoo.so.N
>
> This is what happens on ELF-based systems. On MacOS X, it's exactly the
> same, except names change (DT_SONAME, DT_NEEDED are ELF macro names; MacOS
> X uses Mach-O executables; the dynamic linker in MacOS is called "dyld").
>
> On Windows, it's also similar, but there's no version number. On the other
> hand, it's not symlink either. There's a link-time library (libfoo.a on
> MinGW or foo.lib on MS compilers) and a dynamic library (foo.dll).
> Somewhere in the link library there's the name of the dynamic library.
I think I understood it.
Thanks a lot for your detailed explanations, Thiago (and Andreas, too). Will
update techbase accordingly tonight.
Friedrich
More information about the Kde-buildsystem
mailing list