gcc - How to deal with recursive dependencies between static libraries using the binutils linker? -
i'm porting existing system windows linux. build structured multiple static libraries. ran linking error symbol (defined in liba) not found in object libb. linker line looked like
g++ test_obj.o -la -lb -o test
the problem of course being time linker finds needs symbol liba, has passed by, , not rescan, errors out though symbol there taking.
my initial idea of course swap link (to -lb -la) liba scanned afterwards, , symbols missing libb in liba picked up. find there recursive dependency between liba , libb! i'm assuming visual c++ linker handles in way (does rescan default?).
ways of dealing i've considered:
use shared objects. unfortunately undesirable perspective of requiring pic compliation (this performance sensitive code , losing %ebx hold got hurt), , shared objects aren't needed.
build 1 mega ar of of objects, avoiding problem.
restructure code avoid recursive dependency (which right thing do, i'm trying port minimal changes).
do have other ideas deal this? there way can convince binutils linker perform rescans of libraries has looked @ when missing symbol?
just this:
g++ test_obj.o -la -lb -la -o test
when linker reads first liba on command line, it'll discard object/symbols in noone has depended on yet, e.g. symbols libb needs not test_obj.o. make read liba again, , it'll pick symbols well.
Comments
Post a Comment