On Tue, 19 Jun 2001, Miller Puckette wrote:
Hi all,
Well, I just tried deleting my /usr/lib/libtcl.so symbolic link, and /usr/lib/libtk.so too. Pd still worked for me... I tried configuring and remaking that way, still no problem, and tried running from the RPM instead of compiling, still no problem... I just can't figure out what's going on which makes other systems than mine require libtck.so and libtk.so... if anyone can figure out what's going on I'd be grateful.
There are more concepts involved in this. [Beware, this is long and confusing, only read if you have nothing better to do :)]
First there is a versioning scheme for libraries that says the library should be binary compatible as long as the major version number does not change.
Now, to make sure that two libraries with the same name, but different version numbers can be installed on a system, the major version number of the library that is used by one particular program has to be known.
The name of the dynamic library that will be loaded by the program is written into the binary at linking stage, at the end of the compilation.
e.g. gcc -o foo ffo.c -lm
the linker looks for "-lm" as "libm.so" in the link path (/usr/lib), then (this is important) looks at the "soname" (shared object name) of the file /usr/lib/libm.so, and uses that name to refer to the library. (e.g. libm.so.6).
If no soname is present in the libary, then you will have the case mentioned by Yves, because only "libm.so" will be written into the binary as a library to look for.
This is not distribution independent, because a distribution that only has "runtime" libraries may only provide them as /usr/lib/libm.so.6 (the soname), and then the system will fail to load /usr/lib/libm.so (this link to the library is generally only needed by developers who want to compile their program with -lm).
And because this is not confusing enough, the tcl/tk team decided obviously to put the version numbers of their libraries in front of the ".so", which requires the version number to be known in the compilation of the program too (thats why we search the system for tcl8.0, tcl8.1, etc, same for tk)
There are several ways how the problem on Mandrake could occur. The same for Miller, probably the link line uses -ltk8.3 (instead of -ltk), which would mean that probably the /usr/lib/libtk.so could be of no use at all for the system.
The clue is: The binary might be linked to something different than you expect, because it is linked to the "soname" of the library.
Guenter
References: "man ld" "man ldconfig"