Linker question (proper library names)

Jeroen Ruigrok/asmodai asmodai at wxs.nl
Tue Jul 27 23:38:19 PDT 2004


-On [20040728 05:52], walt (wa1ter at xxxxxxxxxxxxx) wrote:
>I ran across one linker error which stumped me:  ld stopped
>with "can't find XThrStub" even though it was exactly where
>it was supposed to be.
>
>The file the loader needed was actually a symlink, like this:
>libXThrStub.so.6.1 -> ../../lib/XThrStub/libXThrStub.so.6.1
>
>The symlink was correct, but ld insisted the file couldn't
>be found.

And it was correct in doing so.  This is ELF expected behaviour.

>I eventually changed the name of the symlink to just plain
>'libXThrStub.so' which made ld very happy and the compile
>finished without further error.

Or create a symlink from libXThrStub.so.6 -> libXThrStub.so.6.1.

>What puzzles me is that there were dozens of similar symlinks
>in that same directory and AFAIK ld must have used all
>of them but didn't complain about any of the others.

They must've had .so.X related files/symlinks.

>My question is:  why did ld pick that one symlink to fuss
>about?  Why not all the others as well?

Because ELF does not pick up minor numbers.  It only picks up .so.X files,
not .so.X.Y

Example in case:

# ll /usr/local/lib/libttf.so* 
  0 lrwxr-xr-x  1 root  wheel  -     11 Jun 25 12:20 /usr/local/lib/libttf.so@ -> libttf.so.4
512 -rwxr-xr-x  1 root  wheel  - 497203 Jun 25 12:20 /usr/local/lib/libttf.so.4*

# ldconfig -r | grep ttf
        107:-ltiff.4 => /usr/local/lib/libtiff.so.4

# mv libttf.so blah
# ldconfig -R
# ldconfig -r | grep ttf
        107:-ltiff.4 => /usr/local/lib/libtiff.so.4

# mv libttf.so.4 libttf.so.4.1
# ldconfig -R
# ldconfig -r | grep ttf
[nothing]


-- 
Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
Free Tibet! http://www.savetibet.org/ | http://www.tibet.nu/
http://www.tendra.org/   | http://diary.in-nomine.org/
When we have not what we like, we must like what we have...





More information about the Bugs mailing list