编译busybox错误

本文解决嵌入式系统中遇到的两个常见编译问题:一是ipsvd/tcpudp.c文件中write函数返回值被忽略的警告,通过在netfilter.h头文件中包含netinet/in.h解决;二是iptunnel.o文件中未定义引用到__cpu_to_be16的错误,通过在iptunnel.c文件中包含asm/byteorder.h解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.错误一

     ipsvd/tcpudp.c: In function 'tcpudpsvd_main': 

     ipsvd/tcpudp.c:314:10: warning: ignoring return value of 'write', declared with attribute warn_unused_result 

     make[1]: *** [ipsvd/tcpudp.o] 错误1 

     make: *** [ipsvd] 错误2 

解决办法:cd  /usr/local/arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include/linux  找到netfilter.h 头文件,

执行sudo  vi  netfilter.h 打开加入#include <netinet/in.h>头文件即解决

2.错误二

networking/libiproute/lib.a(iptunnel.o): In function `print_tunnel':
iptunnel.c:(.text.print_tunnel+0x1ec): undefined reference to `__cpu_to_be16'
iptunnel.c:(.text.print_tunnel+0x200): undefined reference to `__cpu_to_be16'
iptunnel.c:(.text.print_tunnel+0x238): undefined reference to `__cpu_to_be16'
iptunnel.c:(.text.print_tunnel+0x24c): undefined reference to `__cpu_to_be16'
iptunnel.c:(.text.print_tunnel+0x26c): undefined reference to `__cpu_to_be16'
networking/libiproute/lib.a(iptunnel.o):iptunnel.c:(.text.print_tunnel+0x290): more undefined references to `__cpu_to_be16' follow
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1
linux@linux-my:~/u_boot/busybox-1.7.0$ cd /usr/local/arm/4.4.3/
解决办法:

修改 networking/libiproute/iptunnel.c文件
在#include <asm/types.h>

后面加上
#include <asm/byteorder.h>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值