[svlug] packages v. tarballs (was manners)

Seth David Schoen schoen at loyalty.org
Sat Jun 30 22:38:01 PDT 2001

Joey Hess writes:

> The linker doesn't actually care what the file is named, except for the
> one with the filename that matches the exact text of the soname. The minor
> version has no meaning to the dynamic linker, since it is just used in the
> filename, not in the soname.
> [...]
> Note that the librpmbuild.so -> librpmbuild.so.0.0.0 link is broken, and that
> the file name "librpmbuild.so.1.2.3" bears no resemblance whatsoever to the
> actual soname of librpmbuild (which is "librpmbuild.so.0"). This doesn't
> matter because all of that is cruft that ld-linux.so ignores, all it cares
> about it that it finds a file with a filename identical to the requested
> soname, that internally declares it provides the requested soname.
> The links and the minor versons are there for your convenience, not that of
> the dynamic linker.
> > And yes the ones that specify a minor number _do_ get linked to by
> > applications. You may say it's improper; I will figuratively shrug, and
> > respond that it's reality.
> Programs are linked to whatever the soname is. If the soname is
> "libbz2.so.1.0", the program will link to it. This does not imply though that
> the soname is for a library named bz2 with major number 1 and minor number 0.
> It's not a "soversion", it's a "soname".
> I can make a library with a soname of "1.1.559393992-my-cool-soname", and the
> linker will happily use it, without making any assumptions about what the
> major and minor versions of that are:
> joey at silk:~>LD_LIBRARY_PATH=. ldd ./bar              
>         1.1.559393992-my-cool-soname => ./1.1.559393992-my-cool-soname (0x40016000)
>         libc.so.6 => /lib/libc.so.6 (0x40020000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> joey at silk:~>LD_LIBRARY_PATH=. ./bar
> hello, world
> > I vaguely recall that the whole purpose of those major and minor
> > numbers, and the symlinks that implement them, is to be able to specify 
> > that an application is finicky enough to require a specific minor
> > number, or alternatively that it expects to be able to live with any lib
> > in that major-number family.
> Welp, find some code in ld-linux.so that does that, or show me a behavior
> of it that implies that it tries to parse sonames for version info, I don't
> think you will, though.


So why does ldconfig make all these symlinks?  What good do they do us
if linking is actually done purely on soname?

In what way are the symlinks convenient for us, if no linker will
actually use them for any purpose?

I'd been taught what I think was the same thing Rick had heard, that
the links made by ldconfig made it possible to link against a more or
less specific version or something (kind of like one feature of the
old /opt package manager).  So the folk theory of libraries is that
you can link against libfoo.so.3 and get the most recent libfoo 3,
against libfoo.so.3.1 and get the most recent libfoo 3.1, against
libfoo.so.3.1.4 and get the most recent libfoo 3.1.4, and so on.  At
the bottom of this regress is an actual release version which is, of
course, the most recent version of itself.

I'd also heard that the sonames of libraries had to be _correct_ (i.e.
that a filename alone wasn't sufficient).  The way to reconcile this
with the folk theory is to assume that the dynamic linker does parse
and interpret sonames (e.g. that the linker knows that a shared
library with soname libfoo.so.3.1.4 is actually also a valid
libfoo.so.3.1 and a valid libfoo.so.3, but not a valid libbar.so.3 or
libfoo.so.3.2).  Obviously this it wrong, but it sounded awfully good
to me.  I was so confident in this theory that I mentioned it in
passing in some Linux classes I taught, by way of an example of why
symlinks were useful.

So, once again, where's the convenience in the symlink behavior of

And then why do libraries ever have version numbers below their minor
version numbers, if the version numbers are never parsed at all by the
linker?  Is it just to be cute?

Seth David Schoen <schoen at loyalty.org>  | And do not say, I will study when I
Temp.  http://www.loyalty.org/~schoen/  | have leisure; for perhaps you will
down:  http://www.loyalty.org/   (CAF)  | not have leisure.  -- Pirke Avot 2:5

More information about the svlug mailing list