busybox 编译错误make menuconfig…

本文解决在安装libncurses5-dev包后进行编译时遇到的错误问题,通过检查并安装相关依赖包来解决。

当出现如下面文字中所描叙的如此恐怖的错误的时候,那就一定是 libncurses5-dev 包没有安装了~~

 

 

root@ubuntu:/tmp/busybox-1.19.4#make menuconfig


  HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included fromscripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: No suchfile or directory
In file included fromscripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:128: error: expected ‘=’, ‘,’,‘;’, ‘asm’ or ‘__attribute__’ before ‘use_colors’
scripts/kconfig/lxdialog/dialog.h:129: error: expected ‘=’, ‘,’,‘;’, ‘asm’ or ‘__attribute__’ before ‘use_shadow’
scripts/kconfig/lxdialog/dialog.h:131: error: expected ‘=’, ‘,’,‘;’, ‘asm’ or ‘__attribute__’ before ‘attributes’
scripts/kconfig/lxdialog/dialog.h:143: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/dialog.h:146: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/dialog.h:147: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/dialog.h:148: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/dialog.h:149: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/dialog.h:151: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/checklist.c:31: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/checklist.c:59: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/checklist.c:95: error: expected ‘)’ before‘*’ token
scripts/kconfig/lxdialog/checklist.c: In function‘dialog_checklist’:
scripts/kconfig/lxdialog/checklist.c:117: error: ‘WINDOW’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: error: (Each undeclaredidentifier is reported only once
scripts/kconfig/lxdialog/checklist.c:117: error: for each functionit appears in.)
scripts/kconfig/lxdialog/checklist.c:117: error: ‘dialog’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: error: ‘list’ undeclared(first use in this function)
scripts/kconfig/lxdialog/checklist.c:117: warning: left-handoperand of comma expression has no effect
scripts/kconfig/lxdialog/checklist.c:121: warning: implicitdeclaration of function ‘endwin’
scripts/kconfig/lxdialog/checklist.c:122: warning: implicitdeclaration of function ‘fprintf’
scripts/kconfig/lxdialog/checklist.c:122: warning: incompatibleimplicit declaration of built-in function ‘fprintf’
scripts/kconfig/lxdialog/checklist.c:122: error: ‘stderr’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:140: error: ‘COLS’ undeclared(first use in this function)
scripts/kconfig/lxdialog/checklist.c:141: error: ‘LINES’ undeclared(first use in this function)
scripts/kconfig/lxdialog/checklist.c:143: warning: implicitdeclaration of function ‘draw_shadow’
scripts/kconfig/lxdialog/checklist.c:143: error: ‘stdscr’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:145: warning: implicitdeclaration of function ‘newwin’
scripts/kconfig/lxdialog/checklist.c:146: warning: implicitdeclaration of function ‘keypad’
scripts/kconfig/lxdialog/checklist.c:146: error: ‘TRUE’ undeclared(first use in this function)
scripts/kconfig/lxdialog/checklist.c:148: warning: implicitdeclaration of function ‘draw_box’
scripts/kconfig/lxdialog/checklist.c:148: error: ‘attributes’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:149: warning: implicitdeclaration of function ‘wattrset’
scripts/kconfig/lxdialog/checklist.c:150: warning: implicitdeclaration of function ‘mvwaddch’
scripts/kconfig/lxdialog/checklist.c:152: warning: implicitdeclaration of function ‘waddch’
scripts/kconfig/lxdialog/checklist.c:156: warning: implicitdeclaration of function ‘print_title’
scripts/kconfig/lxdialog/checklist.c:159: warning: implicitdeclaration of function ‘print_autowrap’
scripts/kconfig/lxdialog/checklist.c:166: warning: implicitdeclaration of function ‘subwin’
scripts/kconfig/lxdialog/checklist.c:190: warning: implicitdeclaration of function ‘print_item’
scripts/kconfig/lxdialog/checklist.c:194: warning: implicitdeclaration of function ‘print_arrows’
scripts/kconfig/lxdialog/checklist.c:197: warning: implicitdeclaration of function ‘print_buttons’
scripts/kconfig/lxdialog/checklist.c:199: warning: implicitdeclaration of function ‘wnoutrefresh’
scripts/kconfig/lxdialog/checklist.c:201: warning: implicitdeclaration of function ‘doupdate’
scripts/kconfig/lxdialog/checklist.c:204: warning: implicitdeclaration of function ‘wgetch’
scripts/kconfig/lxdialog/checklist.c:211: error: ‘KEY_UP’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:211: error: ‘KEY_DOWN’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:221: error: ‘FALSE’ undeclared(first use in this function)
scripts/kconfig/lxdialog/checklist.c:222: warning: implicitdeclaration of function ‘scrollok’
scripts/kconfig/lxdialog/checklist.c:223: warning: implicitdeclaration of function ‘wscrl’
scripts/kconfig/lxdialog/checklist.c:232: warning: implicitdeclaration of function ‘wrefresh’
scripts/kconfig/lxdialog/checklist.c:282: warning: incompatibleimplicit declaration of built-in function ‘fprintf’
scripts/kconfig/lxdialog/checklist.c:283: warning: implicitdeclaration of function ‘delwin’
scripts/kconfig/lxdialog/checklist.c:287: error: ‘KEY_LEFT’undeclared (first use in this function)
scripts/kconfig/lxdialog/checklist.c:288: error: ‘KEY_RIGHT’undeclared (first use in this function)
make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
root@ubuntu:/tmp/busybox-1.19.4#make menuconfig
  HOSTCC scripts/kconfig/lxdialog/checklist.o
  HOSTCC scripts/kconfig/lxdialog/inputbox.o
  HOSTCC scripts/kconfig/lxdialog/lxdialog.o
scripts/kconfig/lxdialog/lxdialog.c: In function‘j_inputbox’:
scripts/kconfig/lxdialog/lxdialog.c:192: warning: format not astring literal and no format arguments
  HOSTCC scripts/kconfig/lxdialog/menubox.o
  HOSTCC scripts/kconfig/lxdialog/msgbox.o
  HOSTCC scripts/kconfig/lxdialog/textbox.o
  HOSTCC scripts/kconfig/lxdialog/util.o
  HOSTCC scripts/kconfig/lxdialog/yesno.o
  HOSTLD scripts/kconfig/lxdialog/lxdialog
scripts/kconfig/mconf Config.in
#
# using defaults found in .config
#


Your configuration changes were NOT saved.

<think>嗯,用户需要解决busybox编译报错的问题,这个问题之前已经有过一些互动。用户现在明确询问解决方法,说明之前的引用信息还不够直接解决问题。 首先分析引用内容:引用1显示缺少pod2man工具导致文档生成失败;引用2给出编译环境是Ubuntu;引用3提到函数定义缺失的通用解法;引用4则是特定网络模块的常量未定义错误。这些报错类型完全不同,需要分类处理。 用户可能正在Ubuntu系统上编译较新版本的busybox(如1.29.0),遇到多个独立错误。考虑到用户连续提问,ta大概率是个嵌入式开发新手,正在构建最小Linux系统。编译中断会让ta感到焦虑,需要清晰的步骤指引。 我决定将报错分成三类处理:依赖缺失、内核头文件不匹配、代码兼容性问题。这样分层级解决符合编译问题的排除逻辑。特别要强调“先解决依赖后处理代码”的顺序,因为引用1的错误会掩盖其他问题。 对于pod2man这种文档工具缺失,需要提醒用户安装perl-doc包而非整个perl——毕竟ta在做最小系统,应该避免无关依赖。ARPHRD_INFINIBAND这种常量定义问题则要关联内核版本,busybox社区早有解决方案,直接建议打补丁最实际。 最后生成的三个问题都围绕编译环境:交叉编译是嵌入式常见场景,内核头文件问题在引用4已暴露,依赖管理则是预防性知识。用户如果继续追问,下一步可以讨论menuconfig配置技巧。 </think>根据引用内容和常见编译问题,以下是解决BusyBox编译报错的系统化方法: --- ### **一、主要报错原因及解决方案** #### 1. **依赖工具缺失(如`pod2man`)** - **错误示例** `/bin/sh: 1: pod2man: not found` [^1] - **解决方法** ```bash # Ubuntu/Debian sudo apt-get install perl-doc # 提供pod2man工具 # CentOS/RHEL sudo yum install perl-Pod-Man ``` #### 2. **内核头文件不匹配** - **错误示例** `ARPHRD_INFINIBAND undeclared` [^4] - **解决方法** 更新内核头文件并指定路径: ```bash sudo apt-get install linux-headers-$(uname -r) make menuconfig ``` 在配置中启用: `Settings → Use the kernel's header files (/usr/include)` #### 3. **函数定义缺失** - **错误示例** `undefined reference to [function]` [^3] - **解决方法** - 检查源码目录结构是否完整 - 确认编译命令包含路径: ```bash make CFLAGS="-I/path/to/missing/headers" ``` #### 4. **版本兼容性问题** - **验证步骤** ```bash # 查看内核版本 uname -r # 选择匹配的BusyBox分支 git checkout remotes/origin/1_XX_stable # XX与内核版本对应 ``` --- ### **二、通用排查流程** ```mermaid graph TB A[编译报错] --> B{错误类型} B -->|依赖缺失| C[安装指定工具] B -->|头文件问题| D[更新内核头文件] B -->|函数未定义| E[检查源码路径] B -->|常量未声明| F[启用兼容模式] C --> G[重新make] D --> G E --> G F --> G G --> H[编译成功?] H -->|是| I[完成] H -->|否| J[检查config选项] J --> K[禁用非常用模块] K --> G ``` --- ### **三、关键配置建议** 1. **精简配置**(减少兼容问题): ```bash make defconfig # 使用默认配置 make menuconfig # 手动关闭非常用功能 ``` - 关闭位置: `Networking Utilities → Advanced ifconfig options` [^4] 2. **交叉编译指定工具链**: ```bash make CROSS_COMPILE=arm-linux-gnueabi- ``` --- ### **四、典型修复案例** > **场景**:Ubuntu 22.04编译BusyBox 1.35.0报错`make: *** [docs/busybox.1] Error 127` > **解决方案**: > ```bash > sudo apt install texinfo docbook2x # 补充文档工具链 > make clean > make -j4 > ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值