Mailinglist Archive: opensuse-bugs (4068 mails)

< Previous Next >
[Bug 674696] gcc resolves -lX to

Richard Guenther <rguenther@xxxxxxxx> changed:

What |Removed |Added
InfoProvider| |giecrilj@xxxxxxxxxxxx

--- Comment #10 from Richard Guenther <rguenther@xxxxxxxx> 2011-08-31 11:17:46
UTC ---
I'm still not understanding your issue (trying to cleanup my open bugs). From
the gcc info page:

Search the library named LIBRARY when linking. (The second
alternative with the library as a separate argument is only for
POSIX compliance and is not recommended.)

It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in
the order they are specified. Thus, `foo.o -lz bar.o' searches
library `z' after file `foo.o' but before `bar.o'. If `bar.o'
refers to functions in `z', those functions may not be loaded.

The linker searches a standard list of directories for the library,
which is actually a file named `libLIBRARY.a'. The linker then
uses this file as if it had been specified precisely by name.

The directories searched include several standard system
directories plus any that you specify with `-L'.

Normally the files found this way are library files--archive files
whose members are object files. The linker handles an archive
file by scanning through it for members which define symbols that
have so far been referenced but not defined. But if the file that
is found is an ordinary object file, it is linked in the usual
fashion. The only difference between using an `-l' option and
specifying a file name is that `-l' surrounds LIBRARY with `lib'
and `.a' and searches several directories.


Add directory DIR to the list of directories to be searched for

Which is consistent with gcc -L. -lX finding ./

Or are you refering to the documentation not mentioning _shared_ libraries
(thus, the .so suffix compared to the .a suffix)? The documentation
is probably unchanged from the distant past where there wasn't any ELF port.
On darwin, for example, .dylib, on migw64, for example, .lib suffixes are
used (and possibly different or no prefixes may apply).

Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

< Previous Next >