|
Boost Interest : |
Subject: Re: [Boost-cmake] RFC sonames initial implementation
From: Brad King (brad.king_at_[hidden])
Date: 2009-10-29 15:48:57
troy d. straszheim wrote:
> Is there some standard buildtime toggle for this, or is
> BUILD_SOVERSIONED okay?
There is no standard AFAIK.
> The option is avaiable on UNIX only.
Note that setting VERSION does set the windows "image version" in DLLs,
but it does not affect the file name.
> The implemenation sets VERSION to e.g. 1.41 and SOVERSION to 1.41.0,
> this gets me the symlinks that look most familar to me
Assuming VERSION=1.2 and SOVERSION=3, the layout of symlinks is this:
libfoo.so -> libfoo.so.3 # link to help static linker -lfoo flags
libfoo.so.3 -> libfoo.so.1.2 # link to help dynamic loader
libfoo.so.1.2 # real binary, soname = libfoo.so.3
The soname determines a binary interface version number. When another
binary links to libfoo.so, it copies the soname "libfoo.so.3" into the
new binary. When that binary runs, the dynamic loader searches using
that name...and finds the symlink pointing at the real library.
The ".1.2" is just an implementation version number. In Boost, there is
no binary interface version number because binary compatibility is not
maintained between releases (or is it? perhaps for patch releases?).
If there is no interface version, there is no need for the soname to be
different from the real binary name. IOW, we could just set VERSION=1.2
and no SOVERSION, and CMake will produce
libfoo.so -> libfoo.so.1.2 # link to help static linker -lfoo flags
libfoo.so.1.2 # real binary, soname = libfoo.so.1.2
Whenever a binary links to foo, it will copy the soname "libfoo.so.1.2".
The dynamic loader will search for that name at runtime and find the
real file.
> should we hash out the above SOVERSION-only suggestion further?
That is for Boosters to decide, so I won't
> The implementation does *not* set soversion on libraries of type MODULE,
> as the mac linker complains about -compatibility_version when making a
> bundle. Am I missing anything?
CMake's implementation to pass those flags does this:
// Add OSX version flags, if any.
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
so it should work for SHARED and MODULE libraries equally.
Perhaps the boost CMake code is not setting SOVERSION.
-Brad