linking problems with several static libraries

linking problems with several static libraries

Diego Iastrubni elcuco at kde.org
Sat Jul 13 22:14:05 IDT 2013


On שבת, 13 ביולי 2013 21:42:12 Valery Reznic wrote:
> >And I was under impression that "ld" was supposed to handle such kind of
> >cyclic dependencies. 
> 
> ld indeed able to handle it.
> 
> From ld man page:
> -( 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 
> unde- fined  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 sym- bol referred
> to by an object in an archive that  appears  later  on the command line,
> the linker would not be able to resolve that ref- erence.  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. Regards,
> Valery

mmm.. here lies another problem. I am using ndk-build, which kinda prevents 
you from using direcly the LD command. You tell it which libraries to link and 
it creates the LD/CXX command. I ended hackign inside LOCAL_LDFLAGS, which 
worked. 

I also tried using -Wl,--whole-archive and this is what I got:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libgcc.a(_fixsfdi.o)
(.text+0x2e): unresolvable R_X86_64_PLT32 relocation against symbol 
`__fixunssfti@@GCC_3.0'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libgcc.a(_fixsfdi.o)
(.text+0x12): unresolvable R_X86_64_PLT32 relocation against symbol 
`__fixunssfti@@GCC_3.0'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libgcc.a(_fixdfdi.o)
(.text+0x2f): unresolvable R_X86_64_PLT32 relocation against symbol 
`__fixunsdfti@@GCC_3.0'

and also some references to symbols inside one of the libraries. Again - 
wierd.

Anyway, I can only say that ndk-build is a toy build-system, as much as qmake. 
It works, until it breaks and you need to workaround it.



More information about the Linux-il mailing list