Busybox 1.13.3和其他的1.16版本都是如此 arm-linux-gcc version=4.3.3
===========================================================================================================
networking/slattach.c:232:13: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/slattach.c:241:9: 警告: 忽略声明有 warn_unused_result 属性的‘system’的返回值 [-Wunused-result]
CC networking/tcpudp.o
In file included from /usr/include/linux/sysctl.h:25:0,
from /usr/include/linux/netfilter.h:6,
from /usr/include/linux/netfilter_ipv4.h:8,
from networking/tcpudp.c:35:
/usr/include/linux/kernel.h:12:8: 错误: ‘struct sysinfo’重定义
include/libbb.h:94:8: 附注: 原先在这里定义
networking/tcpudp.c: 在函数‘xsetenv_plain’中:
networking/tcpudp.c:72:3: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c: 在函数‘xsetenv_proto’中:
............
...........
networking/tcpudp.c:452:7: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c:454:8: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c:457:6: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c:457:20: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c:489:8: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
networking/tcpudp.c:490:42: 警告: 提领类型双关的指针将破坏强重叠规则 [-Wstrict-aliasing]
make[1]: *** [networking/tcpudp.o] 错误 1
make: *** [networking] 错误 2
====================================================================================
于是我直接进入include/ 然后 vim libbb.h 看到里面的在Line 92中有一个struct info的定义,然后里面有说明:
90 /* Include our own copy of struct sysinfo to avoid binary compatibility
91 * problems with Linux 2.4, which changed things. Grumble, grumble. */
看来,我认为直接注释掉就行了,因为我用的是Linux 2.6的内核
于是用
#if 0
#endif
完成对这段的注释,但是还是出错,说struct sysinfo仅仅是形参,该如何处理呢?