developingpld:advanceddeveloping:fixingasneeded
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| developingpld:advanceddeveloping:fixingasneeded [2006-08-07 16:27] – - some fixes, gcc <library> trick SamChi | 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 '' |
| - | < | ||
| - | </ | ||
| - | But **don' | ||
| - | Why ? Because it's very stupid. If something fails to build normally | + | |
| + | < | ||
| + | </ | ||
| + | But **don't use it** unless you really need to quickly | ||
| 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. | ||
| Line 41: | Line 50: | ||
| < | < | ||
| </ | </ | ||
| - | library will allways | + | library will __allways__ |
| ==== Short examples ==== | ==== Short examples ==== | ||
| - | Most of problems are with readline/ | + | Most of problems are with readline/ |
| - | But some packages link with readline or ncurses while they use __only__ symbols from tinfo. //Without// '' | + | But some packages link with readline or ncurses while they use __only__ symbols from tinfo. //Without// '' |
| For a longer example take a look at real example nr. 1. | For a longer example take a look at real example nr. 1. | ||
| Line 75: | Line 84: | ||
| - | < | + | < |
| VApp.o: In function `vapp:: | VApp.o: In function `vapp:: | ||
| Line 106: | Line 115: | ||
| - | < | + | < |
| VApp.o: In function `vapp:: | VApp.o: In function `vapp:: | ||
| Line 139: | Line 148: | ||
| - | < | + | < |
| make[1]: Leaving directory `/ | make[1]: Leaving directory `/ | ||
| Line 180: | Line 189: | ||
| - | < | + | < |
| -lgnome-keyring -lpthread | -lgnome-keyring -lpthread | ||
| - | x86_64-pld-linux-gcc -Wl, | + | gcc -Wl, |
| ./ | ./ | ||
| Line 240: | Line 249: | ||
| === What if broken library comes from other package ? === | === What if broken library comes from other package ? === | ||
| - | You can check manually does library has all required symbols, simply running 'gcc //library// ', like this: | + | You can check manually does library has all required symbols, simply running ' gcc //library// ', like this: |
| This is an example of correctly linked library: | This is an example of correctly linked library: | ||
| Line 249: | Line 258: | ||
| collect2: ld returned 1 exit status | collect2: ld returned 1 exit status | ||
| </ | </ | ||
| - | And inclrrectly | + | And incorrectly |
| - | < | + | < |
| / | / | ||
| (.text+0x20): | (.text+0x20): | ||
| Line 260: | Line 269: | ||
| collect2: ld returned 1 exit status | collect2: ld returned 1 exit status | ||
| </ | </ | ||
| + | **Warning: | ||
| + | |||
| Line 281: | Line 292: | ||
| - | < | + | < |
| / | / | ||
| Line 288: | Line 299: | ||
| collect2: ld returned 1 exit status | collect2: ld returned 1 exit status | ||
| </ | </ | ||
| - | function ''' | + | function ''' |
| - | just take a look at my fix: | + | Just take a look at my fix: |
| Line 302: | Line 313: | ||
| + | + | ||
| </ | </ | ||
| - | with this simple change everything works perfectly. | + | With this simple change everything works perfectly. |
developingpld/advanceddeveloping/fixingasneeded.1154960857.txt.gz · Last modified: 2006-08-07 16:27 by SamChi