PLDWWW: DevelopingPLD/AdvancedDeveloping/FixingAsNeeded
sparky
sparky at pld-linux.org
Mon Aug 7 23:51:52 CEST 2006
Author: sparky Date: Mon Aug 7 21:51:52 2006 GMT
Module: PLDWWW URL: http://www.pld-linux.org/DevelopingPLD/AdvancedDeveloping/FixingAsNeeded
---- Log message:
---- Page affected: DevelopingPLD/AdvancedDeveloping/FixingAsNeeded
---- Diffs:
================================================================
{{{
$ gcc -l<library> -Wl,--as-needed <objects.o>
}}}
- library will allways be linked, even if it's not required.
+ library will __allways__ be linked, even if it isn't required.
=== Short examples ===
Most of problems are with readline/ncurses and tinfo, and it's nice
example: tinfo is required by both readline and ncurses, and both
- are linked with this library (now, when I've
+ are linked with this library (now, when
- [http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/readline-shared.patch?r1=1.6&r2=1.7 fixed readline]).
+ [http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/readline-shared.patch?r1=1.6&r2=1.7 fixed readline] is fixed).
But some packages link with readline or ncurses while they use __only__
symbols from tinfo.
''Without'' {{{--as-needed}}} those executables work because
they are linked with tinfo from readline/ncurses library.
- ''With'' {{{--as-needed}}} it will not work, because readline/ncurses
+ ''With'' {{{--as-needed}}} linking will not work, because readline/ncurses
contain no symbols required by executable
so they are not linked, it's dependencies naturally are neither linked.
Thats why there is a need to pass {{{-ltinfo}}}. If it requires only symbols from
@@ -300, +300 @@
And inclorrectly linked one:
{{{
- $ gcc /usr/lib64/liblftp-jobs.so.0.0.0
+ $ gcc /usr/lib64/liblftp-jobs.so.0.0.0
/usr/lib64/gcc/x86_64-pld-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/usr/lib64/liblftp-jobs.so.0.0.0: undefined reference to `StringSet::Remove(int)'
More information about the pld-cvs-commit
mailing list