This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
developingpld:advanceddeveloping:fixingasneeded [2006-08-08 15:42] SamChi - typo |
developingpld:advanceddeveloping:fixingasneeded [2007-05-27 20:51] (current) arekm |
||
---|---|---|---|
Line 4: | Line 4: | ||
- | ==== Quick Workaround ==== | + | ===== Quick and ugly workaround (DON'T USE IT!) ===== |
- | Put in spec file this line: | + | Put this line in ''spec'' file: |
+ | |||
<file>%define filterout_ld -Wl,--as-needed | <file>%define filterout_ld -Wl,--as-needed | ||
</file> | </file> | ||
- | But **don't use it** unless you really need. | + | But **don't use it** unless you really need to quickly build a package. Never ever try to commit such a change. It might be tempting to do so but if you think about it ''--as-needed'' did it's job well and disabled unneeded libraries. If building fails, it's the package that needs to get fixed, not the linker flags. |
- | + | ||
- | Why ? Because it's very stupid. If something fails to build normally it's a sign ''--as-needed'' did well it's job and disabled unneeded libraries. | + | |
Line 20: | Line 20: | ||
- | == About positions == | + | ==== Why it fails for some packages ==== |
+ | In other words, if you list 10 libraries and only 3 of them contain referenced symbols, others are silently discarded. This is a good thing but unfortunately some projects fail to list all their dependencies properly. | ||
+ | |||
+ | This normally works because if project requires libraries //A// and //B// and //A// itself lists //B// as a dependency, both //A// and //B// get pulled in even if the project itself only lists //A//. | ||
+ | |||
+ | Now assume that //A// is a superfluous (unneeded) dependency which gets dropped (or //A// requiring //B// is superfluous and //B// gets dropped from //A//). The symbols are no longer available. | ||
+ | |||
+ | |||
+ | |||
+ | ==== About positions ==== | ||
Linker options are positional, and position is very important. It looks for missing symbols only in libraries coming after object file. | Linker options are positional, and position is very important. It looks for missing symbols only in libraries coming after object file. | ||