[Bug 5528] New: Busybox fails to (cross-)compile with GCC 4.7.1 / missing #include

bugzilla at busybox.net bugzilla at busybox.net
Sat Sep 15 10:30:07 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=5528

           Summary: Busybox fails to (cross-)compile with GCC 4.7.1 /
                    missing #include
           Product: Busybox
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: quintus at quintilianus.eu
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


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?

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list