打印

Busybox 的编译过程 常见错误

[复制链接]
2175|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ferenc2|  楼主 | 2012-3-8 16:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1)下载,解压busybox1.6.1(地址:www.busybox.net/downloads )
  2)make defconfig
  3)make menuconfig
   在[build options]中选择[Build busybox as a static binary]
  4)make
   出现如下错误
   CC applets/applets.o
  applets/applets.c:20:2: warning: #warning Static linking against glibc produces buggy executables
  applets/applets.c:21:2: warning: #warning (glibc does not cope well with ld --gc-sections).
  applets/applets.c:22:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
  applets/applets.c:23:2: warning: #warning Note that glibc is unsuitable for static linking anyway.
  applets/applets.c:24:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections
  applets/applets.c:25:2: warning: #warning from top-level Makefile and remove this warning.
  applets/applets.c:26:2: #error Aborting compilation.
  make[1]: *** [applets/applets.o] Error 1
  make: *** [applets] Error 2
   看来是做为static时不建议用glibc,图省事,不考虑生成文件会大的问题,不打算换uclibc,将applts/applets.c的第19到27行注消
  5)make
   出现如下错误
   CC miscutils/taskset.o
  miscutils/taskset.c:17: error: parse error before '*' token
  miscutils/taskset.c:18: warning: function declaration isn't a prototype
  miscutils/taskset.c: In function `__from_cpuset':
  miscutils/taskset.c:22: error: `CPU_SETSIZE' undeclared (first use in this function)
  miscutils/taskset.c:22: error: (Each undeclared identifier is reported only once
  miscutils/taskset.c:22: error: for each function it appears in.)
  miscutils/taskset.c:26: warning: implicit declaration of function `CPU_ISSET'
  miscutils/taskset.c:26: error: `mask' undeclared (first use in this function)
  miscutils/taskset.c: In function `taskset_main':
  miscutils/taskset.c:47: error: `cpu_set_t' undeclared (first use in this function)
  miscutils/taskset.c:47: error: parse error before "mask"
  miscutils/taskset.c:68: warning: implicit declaration of function `CPU_ZERO'
  miscutils/taskset.c:68: error: `new_mask' undeclared (first use in this function)
  miscutils/taskset.c:69: error: `CPU_SETSIZE' undeclared (first use in this function)
  miscutils/taskset.c:71: warning: implicit declaration of function `CPU_SET'
  miscutils/taskset.c:78: error: `mask' undeclared (first use in this function)
  make[1]: *** [miscutils/taskset.o] Error 1
  make: *** [miscutils] Error 2
   make menuconfig 找到[Miscellaneous Utilities],去掉[task set]
  5)make
  6)make install
  
  搞定,生成的busybox是1.1M,如果不编译成static的话是500多K,但要带gclib用运行.生成的bin和sbin里的程序,还有linuxrc都是指向bin/busybox的符号链接.

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

134

主题

207

帖子

3

粉丝