[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Confusion over library names



Hi,

I've just recently started using Debian Linux.  I've been trying out a
"Hello, world" C++ program, and I've noticed what seems to be an odd naming
disconnect with the files in /usr/lib.

The ld program supports a -l<n> command line option.  This option, as I
understand it, instructs ld to search the libraries /usr/lib/lib<n>.a and
/usr/lib/lib<n>.so for unresolved globals.  However I see several libraries
in /usr/lib with names such as libstdc++.so.272, that is, with something
appended after the .a or .so.  Furthermore, although I see many symlinks for
these files which effectively give a particular library several variations
on a name, in some cases no symlink ending in .a or .so exists.

Playing around with ld, I've discovered that the -l option does not find
files that have .a or .so in the middle of the filename.  It only finds
files that have one of these strings at the end.  So, for instance -lstdc++
doesn't find /usr/lib/libstdc++.so.272.

My questions then:

1. Am I using the -l option in ld correctly?  Is there some way to make it
recognize library names with .so or .a in the middle of a name?

2. Should I create symlinks ending with .so (or .a) for any library with a
name of the form lib<n>.so.blah (or lib<n>.a.blah)?

3. Why do the distribution libraries fail to set up these symlinks for me
when they include other symlinks to give a specific library several names?

Many thanks, in advance, for your help.

Regards,
Michael Banther



Reply to: