Bug 5528 - Busybox fails to (cross-)compile with glibc-2.16 / missing #include
Summary: Busybox fails to (cross-)compile with glibc-2.16 / missing #include
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL: http://git.busybox.net/busybox/commit...
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-15 10:30 UTC by M. Gülker
Modified: 2012-10-20 19:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M. Gülker 2012-09-15 10:30:06 UTC
Hi there,

I’ve downloaded Busybox 1.20.2 and tried to cross-compile it with this compiler:

% arm-linux-gnueabi-gcc --version                 
arm-linux-gnueabi-gcc (GCC) 4.7.1 20120721 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(OS is Arch Linux, 64 bits)

I then set these environment variables:

% export ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

And finally created the default configuration:

% make defconfig

However, trying to compile Busybox now fails:

% make
[...]
  CC      loginutils/passwd.o
loginutils/passwd.c: In function 'passwd_main':
loginutils/passwd.c:104:16: error: storage size of 'rlimit_fsize' isn't known
loginutils/passwd.c:188:2: warning: implicit declaration of function 'setrlimit' [-Wimplicit-function-declaration]
loginutils/passwd.c:188:12: error: 'RLIMIT_FSIZE' undeclared (first use in this function)
loginutils/passwd.c:188:12: note: each undeclared identifier is reported only once for each function it appears in
loginutils/passwd.c:104:16: warning: unused variable 'rlimit_fsize' [-Wunused-variable]
make[1]: *** [loginutils/passwd.o] Fehler 1
make: *** [loginutils] Fehler 2

OK, I don’t need passwd. So I disabled it and all other user/password-related stuff. Next bump:

% make
[...]
  CC      miscutils/time.o
miscutils/time.c:23:16: error: field 'ru' has incomplete type
make[1]: *** [miscutils/time.o] Fehler 1
make: *** [miscutils] Fehler 2

This can be continued a while, until I have disabled a good number of features I don’t really need. Finally, it ends here:

% make
[...]
  CC      shell/shell_common.o
shell/shell_common.c:373:17: warning: 'struct rlimit' declared inside parameter list [enabled by default]
shell/shell_common.c:373:17: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
shell/shell_common.c: In function 'printlim':
shell/shell_common.c:375:2: error: unknown type name 'rlim_t'
shell/shell_common.c:377:13: error: dereferencing pointer to incomplete type
shell/shell_common.c:379:14: error: dereferencing pointer to incomplete type
shell/shell_common.c:381:13: error: 'RLIM_INFINITY' undeclared (first use in this function)
shell/shell_common.c:381:13: note: each undeclared identifier is reported only once for each function it appears in
shell/shell_common.c: In function 'shell_builtin_ulimit':
shell/shell_common.c:416:17: error: storage size of 'limit' isn't known
shell/shell_common.c:433:5: warning: implicit declaration of function 'getrlimit' [-Wimplicit-function-declaration]
shell/shell_common.c:452:6: error: unknown type name 'rlim_t'
shell/shell_common.c:455:13: error: 'RLIM_INFINITY' undeclared (first use in this function)
shell/shell_common.c:480:6: warning: implicit declaration of function 'setrlimit' [-Wimplicit-function-declaration]
shell/shell_common.c:416:17: warning: unused variable 'limit' [-Wunused-variable]
make[1]: *** [shell/shell_common.o] Fehler 1
make: *** [shell] Fehler 2

I do need the shell. So I looked into that file and searched the web a bit. Result: The file shell/shell_common.c misses an include statement at the top:

#include <sys/resource.h>

If you add this, Busybox compiles and runs fine. Probably this is the culprit with the other build errors as well. Interestingly, if I try the same process on Debian with the GCC it supplies:

$ arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

everything works as expected, so I conclude newer GCC versions changed something related to which headers are included by default.

Could you please add this include?

Valete,
Marvin

PS: Could you add a "1.20.x" version tag?
Comment 1 Mike Frysinger 2012-10-20 19:07:45 UTC
fixed a while ago