Building and linking shared libaries for multipledifferentversionsof UNIX

samba-technical at samba-technical at
Wed May 16 17:53:53 GMT 2001

On Wed, May 16, 2001 at 01:31:35PM -0400, Michael Sweet wrote:
> Steve Langasek wrote:
> > ...
> > If you're going to have versioned libraries, you'll also need to
> > pass an option to the linker to specify the versioned soname --
> > otherwise, programs which link against the library won't actually
> > know they need
> What we do is to link the DSO with the version number, e.g.:
>     cc -shared -o *.o
> (this is a ficticious command, of course)
> Then you make the symlink to .so (so the linker can find the DSO
> when you link the other apps), but the soname used is "".
> This isn't universally supported, so there is an added -soname (or
> whatever) in the DSO link on some platforms, but that is the basic
> idea.

If you make the soname the fully versioned name of the library, you
must be very careful about how you version the libraries. If you bump
the version number with every change, even when the API has not
changes, the user must have multiple versions installed (not one
version which exports the same ABI with maybe bugfixes).

I'd advise for an soname that is the same when the ABI is the same
even though the fully versioned library name might be different: -> ->			[soname] could also have soname

albert chin (china at

More information about the samba-technical mailing list