BusyBox各版本下载 http://www.linuxidc.com/Linux/2011-08/40704.htm为了和linux2.6.14对应起来,选用了BusyBox1.1.0,交叉编译器为arm-linux-gcc3.4.1。编译BusyBox时出现如下错误: root@czu:~/桌面/socket/busybox-1.1.0# make make -C /root/桌面/socket/busybox-1.1.0 top_srcdir=/root/桌面/socket/busybox-1.1.0 top_builddir=/root/桌面/socket/busybox-1.1.0 KBUILD_SRC=/root/桌面/socket/busybox-1.1.0 -f /root/桌面/socket/busybox-1.1.0/Makefile _all make[1]: 正在进入目录 `/root/桌面/socket/busybox-1.1.0" scripts/bb_mkdep -c include/config.h -c include/bb_config.h -I /root/桌面/socket/busybox-1.1.0/include /root/桌面/socket/busybox-1.1.0 > .depend.tmp mv .depend.tmp .depend arm-linux-gcc -I/root/桌面/socket/busybox-1.1.0/include -I/root/桌面/socket/busybox-1.1.0/include -I/root/桌面/socket/busybox-1.1.0/libbb -funsigned-char -Wall -Wstrict-prototypes -Wshadow -Os -fstrict-aliasing -fomit-frame-pointer -D_GNU_SOURCE -DNDEBUG -c -o /root/桌面/socket/busybox-1.1.0/applets/applets.o /root/桌面/socket/busybox-1.1.0/applets/applets.c In file included from /root/桌面/socket/busybox-1.1.0/include/busybox.h:27, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /root/桌面/socket/busybox-1.1.0/include/bb_config.h:1: error: parse error before "-" token /root/桌面/socket/busybox-1.1.0/include/bb_config.h:1: error: syntax error at "#" token In file included from /root/桌面/socket/busybox-1.1.0/include/busybox.h:27, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /root/桌面/socket/busybox-1.1.0/include/bb_config.h:759:2: #endif without #if In file included from /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:105, from /root/桌面/socket/busybox-1.1.0/include/busybox.h:33, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/bits/stat.h:90: error: parse error before "}" token In file included from /root/桌面/socket/busybox-1.1.0/include/busybox.h:33, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:358: error: conflicting types for "stat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:208: error: previous declaration of "stat" was here /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:358: error: conflicting types for "stat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:208: error: previous declaration of "stat" was here /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:365: error: conflicting types for "lstat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:236: error: previous declaration of "lstat" was here /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:365: error: conflicting types for "lstat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:236: error: previous declaration of "lstat" was here /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:371: error: conflicting types for "fstat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:212: error: previous declaration of "fstat" was here /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:371: error: conflicting types for "fstat" /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/sys/stat.h:212: error: previous declaration of "fstat" was here In file included from /root/桌面/socket/busybox-1.1.0/include/libbb.h:39, from /root/桌面/socket/busybox-1.1.0/include/busybox.h:50, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /root/桌面/socket/busybox-1.1.0/include/bb_config.h:1: error: parse error before "-" token /root/桌面/socket/busybox-1.1.0/include/bb_config.h:1: error: syntax error at "#" token In file included from /root/桌面/socket/busybox-1.1.0/include/libbb.h:39, from /root/桌面/socket/busybox-1.1.0/include/busybox.h:50, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /root/桌面/socket/busybox-1.1.0/include/bb_config.h:759:2: #endif without #if In file included from /root/桌面/socket/busybox-1.1.0/include/pwd_.h:24, from /root/桌面/socket/busybox-1.1.0/include/libbb.h:44, from /root/桌面/socket/busybox-1.1.0/include/busybox.h:50, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/pwd.h:59: error: parse error before "}" token In file included from /root/桌面/socket/busybox-1.1.0/include/busybox.h:50, from /root/桌面/socket/busybox-1.1.0/applets/applets.c:33: /root/桌面/socket/busybox-1.1.0/include/libbb.h:108: warning: "struct stat" declared inside parameter list /root/桌面/socket/busybox-1.1.0/include/libbb.h:118: warning: "struct stat" declared inside parameter list /root/桌面/socket/busybox-1.1.0/include/libbb.h:119: warning: "struct stat" declared inside parameter list /root/桌面/socket/busybox-1.1.0/include/libbb.h:411: warning: "struct stat" declared inside parameter list /root/桌面/socket/busybox-1.1.0/include/libbb.h:412: warning: "struct stat" declared inside parameter list make[1]: *** [/root/桌面/socket/busybox-1.1.0/applets/applets.o] 错误 1 make[1]:正在离开目录 `/root/桌面/socket/busybox-1.1.0" make: *** [_all] 错误 2处理方法:修改 include/bb_config.h 看到此文件的第一行多了两个字母 -e,删除掉,退出文件再次执行make则可编译通过