On Thu, Aug 17, 2017 at 10:02 AM, Markus Armbruster <arm...@redhat.com> wrote: > Paolo Bonzini <pbonz...@redhat.com> writes: > >> On 15/08/2017 09:30, Markus Armbruster wrote: >>> The stupid fix is to repeat libraries until the link succeeds: >>> >>> test-util-obj-y = libqemuutil.a libqemustub.a libqemuutil.a >>> >>> You may have seen this with -lX11 if you're old enough. >>> >>> ld(1) suggests the linker can do it for us: >>> >>> -( archives -) >>> --start-group archives --end-group >>> The archives should be a list of archive files. They may be either >>> explicit file names, or -l options. >>> >>> The specified archives are searched repeatedly until no new >>> undefined references are created. Normally, an archive is searched >>> only once in the order that it is specified on the command line. >>> If a symbol in that archive is needed to resolve an undefined >>> symbol referred to by an object in an archive that appears later on >>> the command line, the linker would not be able to resolve that >>> reference. By grouping the archives, they all be searched >>> repeatedly until all possible references are resolved. >>> >>> Using this option has a significant performance cost. It is best >>> to use it only when there are unavoidable circular references >>> between two or more archives. >>> >>> Sticking '-Wp,-(' and '-Wp,-)' into the command line I get from make V=1 >>> doesn't work for me, though. >>> >>> The smart solution is not to have .a reference each other. >> >> Nah, I think we should teach those new kids on the block about -lX11 >> instead. :)
This sounds scary... >> >>> Paolo, what do you think? >> >> Another possibility is to just merge the two static libraries into one. > > Sounds good to me! I feel like I have opened a can of worms. I can try and combine libqemustub.a into libqemuutil.a is that the solution? I just want to make sure before I start this. Thanks, Alistair >