[Toybox] - Warnings for static build

Rob Landley rob at landley.net
Fri Oct 4 23:06:30 PDT 2013


On 09/26/2013 12:40:44 AM, Georgi Chorbadzhiyski wrote:
> On 26.9.2013 г. 08:32, Ashwini Sharma wrote:
>> While doing a static build for my ARM board, some warnings are  
>> reported
>> related to linking.
>> 
>> /tmp/ccY8JVYX.o: In function `do_id':
>> id.c:(.text.do_id+0x1b0): warning: Using 'getgrouplist' in statically
>> linked applications requires at runtime the shared libraries from  
>> the glibc
>> version used for linking
>> /tmp/ccRV13xP.o: In function `change_identity':
>> login.c:(.text.change_identity+0x10): warning: Using 'initgroups' in
>> statically linked applications requires at runtime the shared  
>> libraries
>> from the glibc version used for linking
>> 
>> Any pointers on this.
> 
> glibc is not the most suitable library for static linking (as  
> evidenced
> by the message you've posted). Try musl - http://www.musl-libc.org/

Agreed, this isn't a toybox bug, it's a glibc bug.

The reason is that glibc's previous maintainer, Ulrich Drepper, had a  
personal dislike of static linking. When people pointed out to him that  
"hello world" statically linked to over 400k on glibc, he wrote a big  
rant about how nobody should ever statically link anything:

http://www.akkadia.org/drepper/no_static_linking.html

Ulrich had such a bad influence on glibc that the Debian maintainers  
switched to eglibc, which was basically "glibc not maintained by  
Ulrich". After Ulrich lost control of glibc and went to work for  
Goldman Sachs, the new glibc guys have slowly tried to repair the  
damage, but they've got a lot of fixing to do.

Basically use uClibc or musl if you want to staticly link. Static  
linking in glibc is subtly broken and will try to dlopen() various  
libraries even though the rest of the program is static.

Rob
 1380953190.0


More information about the Toybox mailing list